rs = s.executeQuery("SELECT * FROM tblUser");
If Not rs.EOF Then
' Important: You must move to the last record to
' obtain the count of the full recordset
rs.MoveLast
rsCount = rs.RecordCount
' Remember to Return to the First Record so that you can
' continue to use the recordset
rs.MoveFirst
End If
5条答案
按热度按时间jtoj6r0c1#
您的sql无效。ansi标准方法使用窗口函数来执行所需操作:
这将向每一行添加一个新的列——这似乎就是您想要的。还有其他机制,具体取决于执行此操作的底层数据库。
aemubtdh2#
您请求的结果不相关,因此运行两个查询:
并以通常的方式检索值(一个仅用于rs1)。
dced5bon3#
您可以这样做来计算结果集中的行数
这样你可以得到结果集以及计数
hrysbysz4#
由于您已经在访问vba中的记录集,最简单的方法可能是将记录集的计数返回到:
06odsfpq5#
如果您的rdbms不支持窗口函数,则可以选择此选项