load a image from database
hi, I have a problem, I can´t load a image from database (Access)
my code,
'''''''''''
Dim cnn As New OdbcConnection
cnn.ConnectionString = "DSN=Imag"
Dim sSql As String
sSql = "SELECT Imagem,Imagem1 FROM Imagens"
Dim cmd As New OdbcCommand(sSQL, cnn)
cnn.Open()
Dim dr As OdbcDataReader
'cn.Open()
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
If dr.Read Then
Dim bytBLOBData(dr.GetBytes(1, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte
dr.GetBytes(1, 0, bytBLOBData, 0, bytBLOBData.Length)
Dim stmBLOBData As New MemoryStream(bytBLOBData)
PictureBox1.Image = Image.FromStream(stmBLOBData)
End If
dr.Close()
''''''
Erro Messeger : Invalid Parameter
Image Type : CorelDraw.Graphic.7 ou Bits Map
any help??
Thanks Pedro
|