大虾帮帮忙,读取照片
不知道为什么这个会报错3001参数类型不正确,或不在可以接受的范围内,或与其他参数冲突
我这段程序是考的
就是为了从access里读取照片
别的控件是adodc
就这段用了adodb不知道会不会发生问题
Sub ReadFile()
Dim Stm As New ADODB.Stream
Dim Cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strCnn As String
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
'保存到文件
With Stm
.Mode = adModeReadWrite
.Type = adTypeBinary
.Open
.Write rs("Photo")
.SaveToFile App.Path + "\PhotoTemp.bmp"
End With
'显示图片
Picture1.Picture = LoadPicture(App.Path + "\PhotoTemp.bmp")
rs.Close
Stm.Close
Set rs = Nothing
Set Cnn = Nothing
Set Stm = Nothing
End Sub