How to insert or update picture in db2 using vb6
i have succeded to insert into text & number fileds
in the records but the Blob filed cannot be inserted
and have the following message type mismatch
and here is my code
i have succeded to insert into text & number fileds
in the records but the Blob filed cannot be inserted
and have the following message type mismatch
and here is my code
Code:
'-----------------------------------for adding a new record in pictures_file-------------------
Dim S As String
Dim ne1 As Integer
Dim ne2 As Byte
Dim nam As String
Dim Fields(6) As String
Dim values(6) As String
Dim PIC_val As PictureTypeConstants
Dim PIC_SAV As String
Dim PIC1_VAL As LoadPictureConstants
ne1 = Text5.Text
ne2 = Text6.Text
nam = Text7.Text
Fields(0) = "PIC_ID_CODE"
Fields(1) = "PIC_SER"
Fields(2) = "PIC_NAME"
Fields(3) = "PIC_PATH"
Fields(4) = "PIC_TILED"
Fields(5) = "PHOTO_FORMAT"
Fields(6) = "PICTURE"
'PIC_SAV = Picture
values(0) = Text5.Text
values(1) = Text6.Text
values(2) = "'" & Text7.Text & "'"
values(3) = "'" & Text2.Text & "'"
values(4) = "'" & Text4.Text & "'"
values(5) = "'" & Text3.Text & "'"
PIC1_VAL = Picture2.Picture
PIC_SAV = PIC1_VAL
S = ("insert into PICTURES_FILE(" & Fields(0) & "," & Fields(1) & "," & Fields(2) & "," & Fields(3) & "," & Fields(4) & "," & Fields(5) & "," & Fields(6) & " )VALUES(" & values(0) & "," & values(1) & "," & values(2) & "," & values(3) & "," & values(4) & "," & values(5) & "," & PIC1_VAL & ")")
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=ibmdadb2;Driver={IBM DB2 ODBC DRIVER};Database=ARCIV_DB;Hostname=COMPANY-C97BE4D;port=50000;Protocol=TCPIP;Uid=db2admin;Pwd=db2admin"
conn.CursorLocation = adUseClient
conn.Open
conn.Execute S
conn.close
Comment