Hi all,
I'm really need your help regarding how to insert image into blob field in Firebird/Interbase 6.0....I'm using connection trough ODBC ( "DRIVER=Firebird/InterBase(r) driver;UID=SYSDBA;PWD=masterkey;DBNAME=c:\ibss\database\ibssdemo.gdb "
I can manage to pull into SQL Server 2008..but not for Interbase....can anyone help me...here my code that giving error...(SQL -104)
If Not myReader.Item("PHOTO").Equals(DBNull.Value) Then
' Get the image from the database.
Dim imagedata() As Byte = CType(myReader.Item("PHOTO"), Byte())
Dim K As Long
' '
K = UBound(imagedata)
' 'Simpan data temp folder
'
Dim fs As New FileStream("" & myReader.Item(0) & ".jpg", FileMode.OpenOrCreate, FileAccess.Write)
'
fs.Write(imagedata, 0, K)
'
fs.Close()
Dim imgName As String = ("" & myReader.Item(0) & ".jpg")
Dim fs1 As FileStream = New FileStream(imgName, FileMode.Open, FileAccess.Read)
Dim picByte As Byte() = New Byte(fs1.Length - 1) {}
fs1.Read(picByte, 0, System.Convert.ToInt32(fs1.Length))
fs1.Close()
Dim Str As String = "update CARDHOLDER set PHOTO = (" & "@Img) where CARDHOLDERID = '" & myReader.Item(0).ToString & "' "
Dim cmd As New OleDbCommand(Str, cn)
cmd.Parameters.Add("@Img", odbcType.Binary)
cmd.Parameters.Item("@Img").Value = image
cn.open
cmd.ExecuteNonQuery()
cn close
end if