i had a problem with this codes.. this codes will retrieve image from database that will based on the employeenumber.
Dim CN As New OleDbConnection(cnString)
CN.Open()
daImage = New OleDbDataAdapter()
daImage.SelectCommand = New OleDbCommand("SELECT * FROM EmployeeProfile ", CN)
dsImage = New DataSet("dsImage")
Dim dataTable As DataTable = dsImage.Tables(0)
If IDPicturePB.Image IsNot Nothing Then
IDPicturePB.Image.Dispose()
End If
Dim fsImage As New FileStream("image.jpg", FileMode.Create)
For Each dataRow As DataRow In dataTable.Rows
If dataRow(0).ToString() = EmployeeNumberIDTB.Text.ToString() Then
Dim blob As Byte() = DirectCast(dataRow(1), Byte())
fsImage.Write(blob, 0, blob.Length)
fsImage.Close()
fsImage = Nothing
IDPicturePB.Image = Image.FromFile("image.jpg")
IDPicturePB.SizeMode = PictureBoxSizeMode.StretchImage
IDPicturePB.Refresh()
End If
Next
error in this line : Dim dataTable As DataTable = dsImage.Tables(0)
can someone explain it to me? :(
error is Cannot find table 0.