ADO.RecordCount等于 - 1问题 [英] ADO.RecordCount equals - 1 problem

查看:261
本文介绍了ADO.RecordCount等于 - 1问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以往我尝试访问RecordCount属性,我总是得到-1的返回值。下面是我的示例code。

When ever I try to access the RecordCount property, I always get a return value of -1. Below is my sample code.

Set oConn = Server.CreateObject ("ADODB.Connection")
oConn.Open Application("strConnectstring")
Set rs = Server.CreateObject ("ADODB.Recordset")
rs.ActiveConnection = oConn
SQL = "Publications_PicoSearchListing"
set rs = oConn.execute(SQL)

我不知道如果我做forwardCursor或动态游标,或者如果供应商甚至支持RecordCount属性。我如何或检查如果提供程序支持RecordCount属性,如果我使用两种或forwardCursor动态游标。

I'm not sure if I'm doing forwardCursor or dynamic cursors, or if the provider even supports the RecordCount property. How do I check if the provider supports RecordCount property or if I'm using either forwardCursor or dynamic cursors.

任何帮助将是AP preciated。

Any help would be appreciated.

感谢您

推荐答案

有关传呼,你可以使用 recordset.PageSize recordset.AbsolutePage 像这样

For paging you can use the recordset.PageSize and recordset.AbsolutePage like this

Set rs = Server.CreateObject("ADODB.Recordset")
' make recordset use adUSEclient ( client side cursor)'
rs.CursorLocation = 3
' make recordset use the adOpenStatic cursor ( scrollable )'
rs.CursorType = 3
rs.PageSize = RecordsPerPage

rs.Open sql, conn
' go to selected page'
if not rs.EOF and not rs.BOF then
    rs.AbsolutePage = page_you_want_to_go
end if

你再有机会获得 recordset.PageCount 来知道的页数返回..

you then have access to recordset.PageCount to know the number of pages returned..

这篇关于ADO.RecordCount等于 - 1问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆