dim cntTest as connection dim rdsTest as Recordset set cntTest =new connection cntTest.Connectionstring=...... . . . cntTest.CursorLocation = adUseClient set rdsTest=cntTest.Execute("......") rdsTest.Recordcount will greater than -1
if not rs.EOF then rs.movelast recCount=rs.AbsolutePosition + 1 else recCount=0 end if
ado的是很简单的阿!
dim rdsTest as Recordset
set cntTest =new connection
cntTest.Connectionstring=......
.
.
.
cntTest.CursorLocation = adUseClient
set rdsTest=cntTest.Execute("......")
rdsTest.Recordcount will greater than -1
rs.movelast
recCount=rs.AbsolutePosition + 1
else
recCount=0
end if
用其它三种游标(adOpenForwardOnly,adOpenKeyset,adOpenDynamic),返回的不是真实的数.rs.recordcount=-1.
dim rs as new adodb.recordset...rs.CursorLocation = adUseClient
只需要将rs的游标方式设置为adUseClient