实时错误481,无效图片
完全参照百度给的代码的,为什么还错在access里面的photo的属性是ole
Sub ReadFile()
Dim Stm As New ADODB.Stream
Dim Cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strCnn As String
Dim detail As String
FrmQuery.DataGrid1.Col = 1
detail = FrmQuery.DataGrid1.Text
Set rs = New ADODB.Recordset
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & _
App.Path & "\GROUP1.mdb"
Cnn.Open strCnn
rs.Open " select Photo from StdInfo where Name = '" & detail & "'", Cnn, adOpenKeyset, adLockReadOnly
'保存到文件
Set Stm = New ADODB.Stream
With Stm
.Mode = adModeReadWrite
.Type = adTypeBinary
.Open
.Write rs("Photo")
.SaveToFile App.Path + "\PhotoTemp.jpg"
End With
'显示图片
Picture1.Picture = LoadPicture(App.Path + "\PhotoTemp.jpg")
rs.Close
Stm.Close
Set rs = Nothing
Set Cnn = Nothing
Set Stm = Nothing
End Sub
[[italic] 本帖最后由 henshai 于 2007-12-1 13:19 编辑 [/italic]]