Hi,
I am trying to extract image from database into picture box my code is
but i am getting error "Parameter is not valid" the line "Dim bitmap As New Bitmap(stream)"
Plz help
I am trying to extract image from database into picture box my code is
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cnn = New OleDbConnection(strCn)
Dim stream As New MemoryStream()
cnn.Open()
Dim command As New OleDbCommand("select img from llr where llrno = '" & TextBox1.Text & "'", cnn)
Dim image As Byte() = DirectCast(command.ExecuteScalar(), Byte())
stream.Write(image, 0, image.Length)
Dim bitmap As New Bitmap(stream)
picBlob.Image = bitmap
cnn.Close()
End Sub
but i am getting error "Parameter is not valid" the line "Dim bitmap As New Bitmap(stream)"
Plz help
Comment