问题描述
我正在使用Windows 2007并尝试获取记录计数,但它返回-1
I am using windows 2007 and trying to get record count but it is returning -1
以下是我的代码
设置objcon = CreateObject(" ADODB.connection")
设置myrecordset = CreateObject(" ADODB.recordset")
ConnectionString =" provider = sqloledb; Trusted_Connection = Yes" ;
$
objcon.Open ConnectionString," sa",""
Set objcon = CreateObject("ADODB.connection")
Set myrecordset = CreateObject("ADODB.recordset")
ConnectionString = "provider=sqloledb;Trusted_Connection=Yes"
objcon.Open ConnectionString, "sa", ""
myrecordset.CursorLocation = adUseClient
myrecordset.CursorLocation = adUseClient
设置myrecordset = objcon.Execute(strSQLQuery1)
Set myrecordset = objcon.Execute(strSQLQuery1)
MsgBox myrecordset.RecordCount'这是返回-1而不是78。
MsgBox myrecordset.RecordCount ' this is returning -1 instead of 78.
请帮忙,我有尝试了各种光标位置
Kindly help ,I have tried various cursor locations
推荐答案
myrecordset.MoveLast
myrecordset.MoveLast
。
这篇关于记录集中没有记录计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!