VB如何将一张网图上的图片写入数据库

来源:百度知道 编辑:UC知道 时间:2024/06/04 04:10:05
如图片的网址是:http://img.baidu.com/img/logo-zhidao.gif

如何将这张图片写入数据库呢?(SQL2005)

dim aduSave as New ADODB.Recordset
aduSave.Open " select Picture from tblBUltrasonicCheckPic where PersonID='" & txtInfo(0) & "' and ExamineID='" & strExamID & "' and PictureID=" & I, conn, adOpenDynamic, adLockBatchOptimistic
DoEvents
saveCPic(aduSave.Fields("Picture"))
aduSave.UpdateBatch

Public Sub SavePic(adrPic As ADODB.field)
'--保存图像
On Error Resume Next
'On Error GoTo err
Dim bytes() As Byte
Dim file_name As String
Dim file_num As Integer
Dim file_length As Long
Dim num_blocks As Long
Dim left_over As Long
Dim block_num As Long
file_num = FreeFile
Open "c:\photo_pic.jpg" For Binary Access Read As #file_num
file_length = LOF(file_num)
If file_length > 0 Then
num_blocks = file_length / BLOCK_SIZE
left_over = file_length Mod BLOCK_SIZE
ReDim byte