主题:[讨论]为什么出错?????
以下是VB中验证身份的一段小代码,红色字体总是报错。为什么??怎么改??
数据库是ACCESS。
谢谢!!!
Private Sub cmdOK_Click()
'取得不同的用户名和密码
Dim user As String, pwd As String
user = txtUser
pwd = txtPwd
'根据不同的身份,选择不同的表用以查询
Dim r As New ADODB.Recordset
[color=FF0000]Set r = DataEnv.rssqlseek[/color]
Dim strSQL As String
Select Case mnUserType
Case 0: '若身份为管理员
strSQL = "select * from AdminManage where name='" & user & "' and pwd='" & pwd & "'"
Case 1: '若身份为学生
strSQL = "select * from ReaderBorrow where bname='" & user & "'and bcode='" & pwd & "'"
End Select
If r.State = adStateOpen Then r.Close
r.Open strSQL
Static nTryCount As Integer
If r.EOF Then
MsgBox "对不起,无此用户或密码不对!请重新输入!!", vbCritical, "错误"
txtUser.SetFocus
txtUser.SelStart = 0
txtUser.SelLength = Len(txtUser)
nTryCount = nTryCount + 1
If nTryCount > 3 Then
MsgBox "您无权操作本系统!再见!", vbCritical, "无权限"
Unload Me
End If
Else
Load MDIMain
End If
End Sub
并出现 [color=008080][color=0000FF] 实时错误‘430’[/color][/color]
[color=FF0000] 类不支持自动化或不支持期望的接口[/color]
这样的错误,有人能帮帮忙吗?
数据库是ACCESS。
谢谢!!!
Private Sub cmdOK_Click()
'取得不同的用户名和密码
Dim user As String, pwd As String
user = txtUser
pwd = txtPwd
'根据不同的身份,选择不同的表用以查询
Dim r As New ADODB.Recordset
[color=FF0000]Set r = DataEnv.rssqlseek[/color]
Dim strSQL As String
Select Case mnUserType
Case 0: '若身份为管理员
strSQL = "select * from AdminManage where name='" & user & "' and pwd='" & pwd & "'"
Case 1: '若身份为学生
strSQL = "select * from ReaderBorrow where bname='" & user & "'and bcode='" & pwd & "'"
End Select
If r.State = adStateOpen Then r.Close
r.Open strSQL
Static nTryCount As Integer
If r.EOF Then
MsgBox "对不起,无此用户或密码不对!请重新输入!!", vbCritical, "错误"
txtUser.SetFocus
txtUser.SelStart = 0
txtUser.SelLength = Len(txtUser)
nTryCount = nTryCount + 1
If nTryCount > 3 Then
MsgBox "您无权操作本系统!再见!", vbCritical, "无权限"
Unload Me
End If
Else
Load MDIMain
End If
End Sub
并出现 [color=008080][color=0000FF] 实时错误‘430’[/color][/color]
[color=FF0000] 类不支持自动化或不支持期望的接口[/color]
这样的错误,有人能帮帮忙吗?