I have a column that stored picture in an MS Access database. In that column I right-click it and insert object which is picture from file and it said "package" in the column.
The idea is to upload picture to 'pic' column in access database from file, and using 'querypic' table adapter query with parameter is 'comboname.text' is selected to return picture and store it as binary in byte of array
but when i convert it to image i got an error
System.ArgumentException: 'Parameter is not valid.
I checked my b() which is array of byte and it got result {length=40276} can someone help me?
Private Sub cmdSelect_Click(sender As Object, e As EventArgs) Handles cmdSelect.Click
Dim facultytabeladapt As New CSE_DEPTDataSetTableAdapters.FacultyTableAdapter
Dim b() As Byte
Dim s As String
b = facultytabeladapt.querypic(ComboName.Text)
PhotoBox.Image = b21(b)
End Sub
Private Function b21(ByVal b() As Byte) As Image
Dim imgc As New ImageConverter
Dim imgpic As Image = CType(imgc.ConvertFrom(b), Image) 'it has error "System.ArgumentException: 'Parameter is not valid."
Return imgpic
End Function
this probably because of the OLEDB object in pic that i upload directly to access and not RAW binary file
Edit: querypic is
SELECT pic
FROM Faculty
WHERE (faculty_name = ?)
where faculty_name is comboname.text