主题:紧急求救各位大神!!!!VB编程时出现91错误对象变量或with未设置
Private Sub cmdOK_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
UserName = ""
If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户请重新输入用户名",vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtSQL = "select*from user_Info where user_ID=" ' & txtUserName.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户请重新输入用户名¡", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
OK = True
mrc.Close
Me.Hide
UserName = Trim(txtUserName.Text)
Else
MsgBox "密码不正确¡", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
miCount = miCount + 1
End Sub
光标指出在If.mrc.EOF=True 错误,那位大神知道怎么改,十分感谢,可以的话大神留个QQ请教
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
UserName = ""
If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户请重新输入用户名",vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtSQL = "select*from user_Info where user_ID=" ' & txtUserName.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户请重新输入用户名¡", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
OK = True
mrc.Close
Me.Hide
UserName = Trim(txtUserName.Text)
Else
MsgBox "密码不正确¡", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
miCount = miCount + 1
End Sub
光标指出在If.mrc.EOF=True 错误,那位大神知道怎么改,十分感谢,可以的话大神留个QQ请教