954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Loading pictures on ms and vb6 database

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.

TOROOOLOLOOLO
Newbie Poster
16 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

What do you mean by created database with ms .You are using MS Access or MS Sql Server ?

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

here is a sample code for it

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

savePhoto_Error:
MsgBox Err.Description
End Sub

dilip_singh3
Newbie Poster
24 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You