Tony’s Weblog

ASP.NET, MVC, AJAX, SilverLight, C#, WCF Web Service, SQL 2005 and other interesting stuff.

Convert byte array to an Image

Posted by Tony on August 2, 2008

Dim con As New
SqlConnection(“Server=yileiw2;uid=sqlauth;pwd=sqla uth;database=pubs”)
Dim da As New SqlDataAdapter(“Select * From pub_info”, con)
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet()

da.Fill(ds, “Pub_info”)
Dim myRow As DataRow
myRow = ds.Tables(“Pub_info”).Rows(0)

Dim MyData() As Byte
MyData = myRow(“logo”)

Response.Buffer = True
Response.ContentType = “Image/JPEG”

MyCB = Nothing
ds = Nothing
da = Nothing

con = Nothing


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: