Re: Convert byte array to an Image

  • Thread starter Ken Cox [Microsoft MVP]
  • Start date
K

Ken Cox [Microsoft MVP]

Is the image store in the database as a Blob? If so, check out Step 6 here?

http://support.microsoft.com/default.aspx?scid=kb;en-us;326502

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

con.Open()
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"
Response.BinaryWrite(MyData)

MyCB = Nothing
ds = Nothing
da = Nothing

con.Close()
con = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top