采用二进制就可以存了!!!!!!''StrPath为取图片的路径 'Str 为标号,比如你查找的内容“姓名之类的” Public Sub SaveToImage(strPath As String, Str As String, Index As Integer) Dim rstab As New ADODB.Recordset Dim bytBLOB() As Byte Dim intFile As Integer Dim strImagePath As StringstrImagePath = Trim$(strPath) rstab.Open "select zp,HH from fddbrllb where 标号='" & Str & "'", ConnSrv, adOpenKeyset, adLockOptimistic With rstab If strImagePath <> "" Then intFile = FreeFile Open strImagePath For Binary As #intFile ReDim bytBLOB(FileLen(strImagePath)) Get #intFile, , bytBLOB Close #1 If Index = 1 Then .Fields("zp").AppendChunk bytBLOB Else .Fields("HH").AppendChunk bytBLOB End If End If End With rstab.Update rstab.Close Set rstab = Nothing End Sub 程序中可以直接调用, zpPath =dlgDialog .FileName call SaveToImage(zpPath, 张三, 1)
'Str 为标号,比如你查找的内容“姓名之类的”
Public Sub SaveToImage(strPath As String, Str As String, Index As Integer)
Dim rstab As New ADODB.Recordset
Dim bytBLOB() As Byte
Dim intFile As Integer
Dim strImagePath As StringstrImagePath = Trim$(strPath)
rstab.Open "select zp,HH from fddbrllb where 标号='" & Str & "'", ConnSrv, adOpenKeyset, adLockOptimistic
With rstab
If strImagePath <> "" Then
intFile = FreeFile
Open strImagePath For Binary As #intFile
ReDim bytBLOB(FileLen(strImagePath))
Get #intFile, , bytBLOB
Close #1
If Index = 1 Then
.Fields("zp").AppendChunk bytBLOB
Else
.Fields("HH").AppendChunk bytBLOB
End If
End If
End With
rstab.Update
rstab.Close
Set rstab = Nothing
End Sub
程序中可以直接调用,
zpPath =dlgDialog .FileName
call SaveToImage(zpPath, 张三, 1)