Office中国论坛/Access中国论坛
标题:
如何显示SQL中的图片
[打印本页]
作者:
rocket204
时间:
2007-12-21 14:20
标题:
如何显示SQL中的图片
把SQL的一个数据表导到ACCESS中,请问这个表中的图片字段,在ACESS中怎么才能显示出来,谢谢!
作者:
LeeTien
时间:
2010-4-25 21:35
Dim rs As New ADODB.Recordset//sql 字段是二进制的bmp 连接表显示是ole对象
Dim Istm As ADODB.Stream
rs.Open "SELECT 图片 FROM dbo.图库 WHERE id=" & [Forms]![图库]![id], CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Set Istm = New ADODB.Stream
With Istm
.Mode = adModeReadWrite
.Type = adTypeBinary
.Open
.Write rs("图片")
.SaveToFile "c:\image.jpg"
End With
Me.Image1.Picture = "c:\image.jpg"
rs.Close
Istm.Close
Kill "c:\image.jpg"
Set rs = Nothing
Set Istm = Nothing
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3