Public Username As StringPrivate Sub cmdCancel_Click()OK = FalseMe.HideEnd SubPrivate Sub cmdOK_Click()'用来存放SQL语句Dim TxtSQL As String'用来存放记录集对象Dim mrc As ADODB.Recordset'用来存放返回信息Dim MsgText As StringUsername = ""'判断输入用户名是否为空If Trim(txtUserName.Text = "") ThenMsgBox "请输入用户名!", vbOKOnly + vbExclamation, "警告"txtUserName.SetFocusElse'查询指定用户名的记录TxtSQL = "select * from user_Info where Username ='" & txtUserName.Text & "'"'执行查询语句Set mrc = ExecuteSQL(TxtSQL, MsgText)If mrc.EOF = True ThenMsgBox "该用户不存在!", vbOKOnly + vbExclamation, "警告"txtUserName.SetFocusElse'判断输入的密码是否正确If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) ThenOK = Truemrc.CloseMe.HideUsername = Trim(txtUserName.Text)ElseMsgBox "密码输入错误!", vbOKOnly + vbExclamation, "警告"txtPassword.SetFocustxtPassword.Text = ""End IfEnd IfEnd IfEnd Sub这里面不断抛出错误,实时错误 91,对象变量或with块变量未设置,调试出错的部位为If mrc.EOF = True Then,请问是怎么回事,该怎么解决?在线等。具有该怎么操作呢,我刚接触VB不久,对它没有太多的认识。调试ExecuteSQL返回的是mrc.EOF = <对象变量或with块变量未设置>
添加回答
举报
0/150
提交
取消