get image data from dataset (insead of directly from db)

M

MattB

I have a slightly different twist on the old question "How do I display
images stored in my database?".

My application does not talk directly to the database. It uses a COM+ dll to
deliver serialized datasets. Then I de-serialize those datasets and work
from those.

All the examples I've seen use a SQL adaptor to stream the data and I can't
quite make that work directly from a dataset. I've tried the following code
but I get a "Specified cast is invalid" when I try to assign a byte array
variable the value from the dataset field (which I see in the debugger is of
a type 'bin.hex'). I also can't seem to get convert.tobyte to work (probably
since it's a byte array). Anyone got any hints for me? Seems like I'm
close, but no cigar.

Dim oRow As DataRow

oRow = oDs.Tables(1).Rows(0)

Dim MyData() As Byte

MyData = oRow.Item("mug_shot") 'this is where I hit the casting error

Response.Buffer = True

Response.ContentType = "Image/JPEG"

Response.BinaryWrite(MyData)


If it matters, these are jpeg images stored as type images in sql server,
but are delivered as strings (serialized datasets). Thanks!

Matt
 
M

MattB

Thanks, I think you are correct, but I still have the problem of the data
being in 'bin.hex'.
Any suggestions or examples for converting the image data from 'bin.hex' to
a bit array?

Matt
 

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,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top