Convert image to byte

S

su see

While dr.Read

form = dr("form")

Dim img As Image
Dim b() As Byte
b = form
If b.Length > 0 Then
Dim stream As New MemoryStream(b, True)
stream.Write(b, 0, b.Length)
* img = New Bitmap(stream)
stream.Close()
End If
End While

Now, I want to retrieve the form and displayed into the picturebox form
(form is one of my attributes in a table and its datatype is varbinary).
The form was inserted as a byte into the database. I have problem with
the above code. Does anyone know why? Thank you.

The below error occured at * statement.
An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll
Invalid parameter used.


:)
 

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