Hello, Everyone,
I need your help with my code, I am trying to display the image from database to picturebox but I can't figure it out. Below is my code:
Private Sub LoadImage(ByVal ind As Integer)
Dim cn As New SQLiteConnection("Data Source=C:\db\QC_ASD_2013_08_09.qdb")
Dim cmd As New SQLiteCommand(String.Concat("SELECT beeld_data FROM image WHERE port_item_id=", ind), cn)
Dim da As New SQLiteDataAdapter(cmd)
Dim ds As New DataSet()
da.Fill(ds, "image")
Dim c As Integer = ds.Tables("image").Rows.Count
If c > 0 Then
Dim bytBLOBData() As Byte = _
System.Text.Encoding.UTF8.GetBytes(ds.Tables("image").Rows(c - 1)("beeld_data"))
Dim stmBLOBData As New MemoryStream(bytBLOBData)
PictureBox1.Image = Image.FromStream(stmBLOBData)
End If
End Sub
It always says parameter is invalid. Please see below:
Here's the SQlite DB that I am using. ---> http://www.sendspace.com/file/cw8rlm