vb6.0 怎样用image控件读取ACCESS中以二进制保存的图片

来源:百度知道 编辑:UC知道 时间:2024/09/21 16:39:00
本人新手,最好详细一点。
急急急!!!!!!!!!!!!

Dim con As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim ChunkSize As Long, Chunks As Long, Chunk() As Byte
Dim i As Integer, j As Integer, MediaTemp As String
ChunkSize = 10000
For i = 1 To List1.ListCount - 1
If Len(Dir(dbPath + "img\" + List1.List(i), vbDirectory)) = 0 Then MkDir (dbPath + "img\" + List1.List(i))
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbPath + List1.List(i) + ".mdb;Persist Security Info=False"
con.Open
RS.Source = "select * from [Images] order by ID"
RS.ActiveConnection = con
RS.Open
If RS.EOF Then
RS.Close
Exit Sub
End If
Do While Not RS.EOF
'第二步,读出长二进制数据即图片数据,把它转换成图片文件,操作过程如下
MediaTemp = dbPath + "img\" + List1.List(i) + "\" + RS.Fields
DataFile = 1
O