G
Glen
I have a datatable in SQL2005 that stores images. I am able to write
the image data to the row (image type) and it looks correct (afaik).
My problem comes when trying to retreive the image and display it as a
property in my custom object.
Here is my code:
Dim fileByte() As Byte
fileByte = CType(dt.Rows(0)("Image"), Byte())
Dim stream As IO.MemoryStream = New IO.MemoryStream(fileByte)
Me._image = System.Drawing.Image.FromStream(stream)
On the last line, when I try to read from the memory stream to create
the image I get an error: "ArgumentException not handled. Parameter is
not valid."
I've set breakpoints to look at the data. The "fileByte" array IS
getting filled with data and the "stream" is instantiated and not
nothing. But, as soon as I try to set "Me._image", I get the error.
"Me._image" is type System.Drawing.Image
Any help would be grealty appreciated.
Sincerely,
Glen Wolinsky
the image data to the row (image type) and it looks correct (afaik).
My problem comes when trying to retreive the image and display it as a
property in my custom object.
Here is my code:
Dim fileByte() As Byte
fileByte = CType(dt.Rows(0)("Image"), Byte())
Dim stream As IO.MemoryStream = New IO.MemoryStream(fileByte)
Me._image = System.Drawing.Image.FromStream(stream)
On the last line, when I try to read from the memory stream to create
the image I get an error: "ArgumentException not handled. Parameter is
not valid."
I've set breakpoints to look at the data. The "fileByte" array IS
getting filled with data and the "stream" is instantiated and not
nothing. But, as soon as I try to set "Me._image", I get the error.
"Me._image" is type System.Drawing.Image
Any help would be grealty appreciated.
Sincerely,
Glen Wolinsky