打开数据库出错,请帮忙,谢谢
Dim temp As String
temp = App.Path + "\database.mdb;"
If MsgBox("要清空上次登记记录吗?", vbYesNo) = vbYes Then
Set mainconnection = New ADODB.Connection
Set selectallcmd = New ADODB.Command
Set currentrecordset = New ADODB.Recordset
mainconnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & temp & "Persist Security Info=False"
selectallcmd.CommandType = adCmdText
selectallcmd.CommandText = "select * from baseinfo"
mainconnection.Errors.Clear
mainconnection.Open '此地方出错
selectallcmd.ActiveConnection = mainconnection
If mainconnection.State <> adStateOpen Then
MsgBox "数据库打开出错!"
Exit Sub
End If
Set currentrecordset = selectallcmd.Execute
MsgBox currentrecordset.State
currentrecordset.MoveFirst
While Not currentrecordset.EOF
currentrecordset.Fields(8).Value = "//" '更新
currentrecordset.MoveNext
Wend
mainconnection.Close
MsgBox "数据库更新完毕!"
End If
Exit Sub
错误信息:
Run-time error
Cound not find installable ISAM