Insert picture using VB into SQL Server for Datatype Image.
Insert picture using VB into SQL Server for Datatype Image.
Rate Insert picture using VB into SQL Server for Datatype Image.
(1(1 Vote))
On Error GoTo ErrHandler
Dim bytData() As Byte
Dim sFileName As String
sFileName = "Path and Name of your Picture for insert"
Open sFileName For Binary As #1
If FileLen(sFileName) = 0 Then
MsgBox "Your Message"
Close #1
Exit Sub
Else
ReDim bytData(FileLen(sFileName))
Get #1, , bytData
Close #1
With rsPic 'Assuming u have open your recordset
.AddNew
.Fields("EmployeePhoto").AppendChunk bytData
'Assuming EmployeePhoto is Field in Database with datatype as image
'Your Other Related Fields here
.Update
End With
End If
Exit Sub
ErrHandler:
MsgBox Str(Err.Number) + " : " + Err.Description, vbInformation
Err.Clear
End Sub
Insert picture using VB into SQL Server for Datatype Image. Comments
No comments yet — be the first to post one!
Post a Comment