vb中if mrc.eof=true then报错91,我在控制面板——管理也测试过可以喝SQL连接的,为什么还会报错呢?怎么跨过这个?
具体的代码:Option Explicit
Public OK As Boolean
Dim miCount As IntegerPrivate Sub cmdCanel_Click()End SubPrivate Sub cmdCancel_Click()
OK = False
Me.Hide
End SubPrivate Sub Form_Load()
OK = False
miCount = 0
End Sub
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
If miCount = 3 Then
Me.Hide
End If
Exit Sub
End Sub
有心的帮忙找一下
具体的代码:Option Explicit
Public OK As Boolean
Dim miCount As IntegerPrivate Sub cmdCanel_Click()End SubPrivate Sub cmdCancel_Click()
OK = False
Me.Hide
End SubPrivate Sub Form_Load()
OK = False
miCount = 0
End Sub
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
If miCount = 3 Then
Me.Hide
End If
Exit Sub
End Sub
有心的帮忙找一下
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货