Tony’s Weblog

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

Posts Tagged ‘VB.NET’

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


Posted in Uncategorized | Tagged: | Leave a Comment »