当我尝试访问RecordCount属性时,我总是得到-1的返回值.以下是我的示例代码.
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)
Run Code Online (Sandbox Code Playgroud)
我不确定我是在做forwardCursor还是动态游标,或者提供者是否支持RecordCount属性.如何检查提供程序是否支持RecordCount属性,或者我是否使用forwardCursor或动态游标.
任何帮助,将不胜感激.
谢谢
对于分页,您可以使用recordset.PageSize和recordset.AbsolutePage像这样
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
Run Code Online (Sandbox Code Playgroud)
然后您就可以recordset.PageCount了解返回的页数。
| 归档时间: |
|
| 查看次数: |
13970 次 |
| 最近记录: |