爲什麼我的圖像沒有插入?這是我的代碼。vb 6.0將圖像位圖插入ms訪問數據庫
Sub SaveToDBs(strImagePath As String, fname As String)
rs.Close
rs.Open "Sheet1", conn, adOpenDynamic, adLockBatchOptimistic, adCmdTable
Dim bytBLOB() As Byte
MsgBox strImagePath
Dim intNum As Integer
With rs
intNum = FreeFile
Open strImagePath For Binary As #intNum
ReDim bytBLOB(FileLen(strImagePath))
'Read data and close file
Get #intNum, , bytBLOB
Close #1
.Fields(fname).AppendChunk bytBLOB
.Update
End With
MsgBox "done"
End Sub
我得到了「完成」msgbox,但沒有插入圖像!!!!
是你的列'OLE Object'類型嗎?你使用「綁定對象框架」控件來顯示圖像嗎? – wqw 2011-04-13 07:39:24
@wqw是的,該字段是OLE對象類型。 – Anand 2011-04-13 08:08:07