BLOB Retrieve and Display problems

A

Adam

I have extensively searched for a solution. Below is my code that is
contained in an aspx. When my browser hits this aspx, I just get the
standard broken image picture. I know the data is the database is
correct because I have seen another employee retrieve it using Crystal
Reports. Can someone please tell me what I am doing wrong and offer a
suggestion to make this work? (This code does not generate errors, I
just can't the image to display.)


Adam
-----

Dim objSqlConnection As New SqlConnection
objSqlConnection.ConnectionString =
Application("ConnectionString")

Dim id As Integer
id = 1956

Dim SQLcn As New
SqlConnection(objSqlConnection.ConnectionString)

SQLcn.Open()

Dim cmd As New SqlCommand("select ImageFile from
xcultivarimages where cultivarid=" & id, SQLcn)

Dim objDS As New DataSet
Dim clsImages As New Plantware.clsCultivarImages(SQLcn, objDS)

Dim imageArray As DataRow() =
objDS.Tables(0).Select("Cultivarid = " & id)
Dim imageRow As DataRow

For Each imageRow In imageArray
Response.Expires = 0
Response.Buffer = True
Response.Clear()
Response.ContentType = "image/jpeg"
Response.BinaryWrite(imageRow("ImageFile"))
Next
 
D

dave wanta

you are trying to write out multiple images at the same time. The browser is
only expecting 1 image. Because you sent the data contained in multiple
images, it thinks that the 1 image is corrupt.

Try only writing out 1 image.

If you need to create a list of images, then you will need to create a html
page and link to each image separately.

hth,
Dave
www.aspNetEmail.com
 
A

Adam

Dave,
Thanks for your response. I tried displaying only one image, but it
still did not work. I then found out that the images were place into
the DB table using Access. From reading other posts, this leads me to
believe there is a header on the binary data. Is this true? If so,
how do I strip that header off?


Adam
 

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

Top