I use bottom code:
Sub ReadBlob
Dim cursor1 As ResultSet
'Using ExecQuery2 is safer as it escapes special characters automatically.
'In this case it doesn't really matter.
cursor1 = sql1.ExecQuery2("SELECT image FROM table2 WHERE name = ?", Array As String("smiley"))
cursor1.NextRow
Dim Buffer() As Byte 'declare an empty byte array
Buffer = cursor1.GetBlob("image")
Dim InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
Dim Bitmap1 As Image
Bitmap1.Initialize2(InputStream1)
InputStream1.Close
'ImageViewSQL.SetBackgroundImage(Bitmap1)
End Sub
How I can read a Blob field with image from a MySQL database and the image in a ImageView?
Sub ReadBlob
Dim cursor1 As ResultSet
'Using ExecQuery2 is safer as it escapes special characters automatically.
'In this case it doesn't really matter.
cursor1 = sql1.ExecQuery2("SELECT image FROM table2 WHERE name = ?", Array As String("smiley"))
cursor1.NextRow
Dim Buffer() As Byte 'declare an empty byte array
Buffer = cursor1.GetBlob("image")
Dim InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
Dim Bitmap1 As Image
Bitmap1.Initialize2(InputStream1)
InputStream1.Close
'ImageViewSQL.SetBackgroundImage(Bitmap1)
End Sub
How I can read a Blob field with image from a MySQL database and the image in a ImageView?