出现:Object variable or With block variable not set (Error 91)
vb吧
全部回复
仅看楼主
level 2
booker1234 楼主
就是这段:(验证用户名和密码的程序。用的是SQLSERVER2000,WINDOW2000) Dim txtSQL As String Dim mrc As ADODB.Recordset Dim MsgText As String txtSQL = "select * from user_Info where user_ID = '"&txtUserName.Text & "'" Set mrc = ExecuteSQL(txtSQL, MsgText) If mrc.EOF = True Then执行后有一个黄条条在 “ If mrc.EOF = True Then”上面!然后出现:“Object variable or With block variable not set (Error 91)”请大虾们指点迷津!附录:自定义函数ExecuteSQL(txtSQL, MsgText)的代码: Public Function ExecuteSQL(ByVal SQL _ As String, MsgString As String) _ As ADODB.RecordsetsTokens = Split(SQL) Set cnn = New ADODB.Connection cnn.Open ConnectString(此连接代是:ConnectString= "FileDSN=studentinfo.dsn;UID=sa;PWD=") If InStr("INSERT,DELETE,UPDATE", _ UCase$(sTokens(0))) Then cnn.Execute SQL MsgString = sTokens(0) & _ " query successful" Else Set rst = New ADODB.Recordset rst.Open Trim$(SQL), cnn, _ adOpenKeyset, _ adLockOptimistic 'rst.MoveLast 'get RecordCount Set ExecuteSQL = rst MsgString = "查询到" & rst.RecordCount & _ " 条记录 " End If
2004年11月22日 08点11分 1
level 1
这段代码,可以在我的机器上调试通过.VB6+XP sp2+SQL2000
2004年11月22日 09点11分 2
level 2
booker1234 楼主
那为什么在我的机器上就不可以了呢?
2004年11月22日 23点11分 3
level 1
下载这个文件试一试,Error 91应该是缺少系统环境.http://www.nww.cn/softso/sp1.rar
2004年11月23日 00点11分 4
level 1
安装密码:111-1111111
2004年11月23日 00点11分 5
level 0
是"对象变量或WITH块变量未定义"少了"SET"或对象
2005年02月07日 16点02分 6
level 0
把Dim mrc As ADODB.Recordset改为 Dim mrc As NEW ADODB.Recordset
2010年08月04日 06点08分 7
level 1
主动提交文件 保存报错91 问题不是电脑问题,是复制粘贴的文件,的原文件中有修订没有接受的内容,需在原文件中,接受所有修订,然后在复制粘贴。
2021年09月01日 09点09分 8
1