已经用VB写了界面及代码,在调试时出现了‘91’错误:对象变量或with块变量没设置。请问要怎样解决啊?硪的目的其实就是想,输入帐号密码后,点击按钮,程序从数据库中查找所有的帐号和密码,如果有所输入的帐号及密码,程序通过登录,否则,不予通过。现在已经写好了,但出现了‘91’错误,求助!硪的代码如下:
Dim mrc As ADODB.Recordset
txtsql = "select username from use where username=""&trim(text1.text)&"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then(这里提示‘91’错误了!)
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Exit Sub
End If
If mrc.EOF = True Then(这里硪想也会有提示,但因为上面的过不了所以这里暂时没事。)
MsgBox "登录成功!", vbExclamation + vbOKOnly, "登录"
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Exit Sub
End If
Unload Me
Shell "kldt.dat", vbMaximizedFocus
另外想问,有没有简单的程序可以实现硪想要的这个功能啊?
Dim mrc As ADODB.Recordset
txtsql = "select username from use where username=""&trim(text1.text)&"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then(这里提示‘91’错误了!)
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Exit Sub
End If
If mrc.EOF = True Then(这里硪想也会有提示,但因为上面的过不了所以这里暂时没事。)
MsgBox "登录成功!", vbExclamation + vbOKOnly, "登录"
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Exit Sub
End If
Unload Me
Shell "kldt.dat", vbMaximizedFocus
另外想问,有没有简单的程序可以实现硪想要的这个功能啊?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货