txtSQL = "select * from class_Info where"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.MoveFirst
出现错误:Object variable or with block variable not set
其中class_Info表一开始没有任何纪录
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.MoveFirst
出现错误:Object variable or with block variable not set
其中class_Info表一开始没有任何纪录
mrc.MoveFirst为了判断是否为空表,我用
If Not mrc.EOF Then '如果没有任何纪录的话
mrc.MoveFirst
End If
能正确运行了。但不知道是否完整,要不要判断mrc.BOF???
txtSQL = "select * from class_Info where"
Set mrc = ExecuteSQL(txtSQL, MsgText)'记录数大于0
if mrc.RecordCount>0 then
...........
else
endif
应该是txtSQL = "select * from class_Info "吧?
好像用open打开的表当前纪录就是第一个纪录,所以不用MoveFirst也可以。还有我每次执行mrc.RecordCount都是-1;在已经有记录的境况下,也是这样。
还有对于mrc.CursorLocation = adUseClient有什么用?
为客户端游标,.RecordCount的值就出来了!
mrc.CursorLocation = adUseClient
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.RecordCount > 0 Then '如果有任何纪录的话
mrc.MoveFirst
End If
好像不行
recordcount 的属性不是每一种数据提供者都支持。
即便支持,当数据量很大的时候也不是马上就可以得到他的正确值。没有正确值的时候,recordcount的默认值是-1。