Private Sub ImportBLOB()Dim rs As New ADODB.Recordset Dim stm As ADODB.StreamSet stm = New ADODB.Stream' Skip any table not found errors On Error Resume Next 'cn.Execute "drop table BinaryObject"On Error GoTo 0 'Create the BinaryObject tablers.Open "Select * from a where 1=2", cn, adOpenKeyset, adLockOptimistic 'Read the binary files from disk stm.Type = adTypeBinary stm.Open stm.LoadFromFile App.Path & "\1.bmp"rs.AddNew rs!c = App.Path & "\1.bmp" rs!r = stm.Read'Insert the binary object in the table rs.Updaters.Close stm.CloseSet rs = Nothing Set stm = Nothing End Sub'显示图片 Private Sub DisplayBLOB()Dim rs As New ADODB.Recordset' Select the only image in the table rs.Open "Select * from a ", cn, adOpenForwardOnlySet imgBinaryData.DataSource = rs 'imgBinaryData为图片框imgBinaryData.DataField = rs!r.Namers.Close Set rs = Nothing End Sub
Dim stm As ADODB.StreamSet stm = New ADODB.Stream' Skip any table not found errors
On Error Resume Next
'cn.Execute "drop table BinaryObject"On Error GoTo 0
'Create the BinaryObject tablers.Open "Select * from a where 1=2", cn, adOpenKeyset, adLockOptimistic
'Read the binary files from disk
stm.Type = adTypeBinary
stm.Open
stm.LoadFromFile App.Path & "\1.bmp"rs.AddNew
rs!c = App.Path & "\1.bmp"
rs!r = stm.Read'Insert the binary object in the table
rs.Updaters.Close
stm.CloseSet rs = Nothing
Set stm = Nothing
End Sub'显示图片
Private Sub DisplayBLOB()Dim rs As New ADODB.Recordset' Select the only image in the table
rs.Open "Select * from a ", cn, adOpenForwardOnlySet imgBinaryData.DataSource = rs 'imgBinaryData为图片框imgBinaryData.DataField = rs!r.Namers.Close
Set rs = Nothing
End Sub