Skip to content
Advertisement

SQL output parameter of varbinary to use as image on ASPX web form

I am trying to retrieve the logo stored into my table and display the image from the database to my aspx web page. I have output parameters in a SQL stored procedure which output the name and a varbinary data type. In the SQL table the first column is name which is NVARCHAR(100) and the second column is an image logo. using SQL SERVER for DBMS.

E.g. Client1 is name and Logo looks like this: 0x89504E470D0A1A0A0000000D49484452000000C8000000C80802000000223A39C9000000097048597300002E2300002E230178A53F76000000206348524D00007A25000080830000F9FF000080E9000075300000EA6000003A980000176F925FC546000012954944415478DAEC9D79741455BE80BFEA4EBA3B0B09092124806149D80504C20E0282FA044591F500E2809C0047715F8E8EC3E0E8F846F1313A7014C4055704065…

Example SQL code to insert into table:

Stored proc called in C# code:

C# – Index.aspx.cs:

How do I get the output variable of the logo and store it as an image to use on my web page??

Advertisement

Answer

Try this code

On aspx page

On CS page

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement