VB+access97
模快中定义:
Public conn As New ADODB.Connection
Public rs As New ADODB.Recordset
启动窗口
Private Sub Form_Load()
On Error GoTo errorlabel
Textpwd.Text = ""
Textuser.Text = ""
Dim str$, pathstr As String
pathstr = App.Path
If Right(pathstr, 1) <> "\" Then
pathstr = pathstr + "\"
End If
str = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & pathstr & "db\gbxx.mdb"
conn.CursorLocation = adUseClient
conn.Mode = adModeUnknown
conn.Open str
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
Exit Sub
errorlabel:
MsgBox "非法用户或非法操作", vbOKOnly + vbInformation, "拒绝进入"
End
End Subrs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
模快中定义:
Public conn As New ADODB.Connection
Public rs As New ADODB.Recordset
启动窗口
Private Sub Form_Load()
On Error GoTo errorlabel
Textpwd.Text = ""
Textuser.Text = ""
Dim str$, pathstr As String
pathstr = App.Path
If Right(pathstr, 1) <> "\" Then
pathstr = pathstr + "\"
End If
str = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & pathstr & "db\gbxx.mdb"
conn.CursorLocation = adUseClient
conn.Mode = adModeUnknown
conn.Open str
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
Exit Sub
errorlabel:
MsgBox "非法用户或非法操作", vbOKOnly + vbInformation, "拒绝进入"
End
End Subrs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
MsgBox "非法用户或非法操作", vbOKOnly + vbInformation, "拒绝进入"
End
End Subrs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
'-------------最后两句看不太懂-----------------
一般情况下430的产生是由于没有实例化对象或者对象的引用错误产生的。
或安装MDAC_TYPE.exe
set rs= New ADODB.Recordset