HI
I have created database with ms and linked it with vb6 user interface.But i have a problem linking or loading pictures to the records.I need help on how this can be done,and if possible how pictures can be loaded with it's corresponding data into the database at runtime.
Thank you.
Private Sub Savephoto()
On Error GoTo savePhoto_Error
Dim rsIMG As New ADODB.Recordset
Dim bytBLOB() As Byte
Dim intNum As Integer
Set rsIMG = New ADODB.Recordset
rsIMG.ActiveConnection = CNN
rsIMG.CursorType = adOpenKeyset
rsIMG.LockType = adLockPessimistic 'Invoke Pessimistic Locking
rsIMG.CursorLocation = adUseServer
rsIMG.Open "Select * from em where emp_id = " & ID
With rsIMG
intNum = FreeFile
Open txt_IMGnm.Text For Binary As #intNum
ReDim bytBLOB(FileLen(txt_IMGnm.Text)) 'Read data and close file
Get #intNum, , bytBLOB
Close #1
.Fields("Photo").AppendChunk bytBLOB 'Store the BLOB
.Update
End With
rsIMG.MoveFirst
Exit Sub