类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
如何用VB把图片上传到,SQL的IMAGE字段里面.
网友回答:
Private Sub ImportBLOB()
Dim rs As New ADODB.Recordset
Dim stm As ADODB.Stream
Set 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 table
rs.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.Update
rs.Close
stm.Close
Set rs = Nothing
Set stm = Nothing
End Sub