Hi can you page through a recordset like:
set objRS=objConn.OpenSchema(adSchemaTables)
using objRS.PageSize, objRS.CacheSize, objRS.AbsolutePage, etc.?
I set the objConn.IsolationLevel to 4096 (adoIsolationLevel).
I read that adSchemaTables returns a server-side read-only recordset of cursortype static. Is the server-side attribute what is causing it not to work? I don't get any errors when I set the absoultepage, but the same records are returned no matter what page i set it to.
What I want to do is get a list of tables and column names in my database, but some tables have lots of column so I want to page through the results instead of waiting 5 minutes for the script to finish.
Server.ScriptTimeout=480
Response.Buffer=true
Dim objConn,objRS,objRS2,ctr,temp
Const adoIsolationLevel=4096
Dim iPageSize 'How big our pages are
Dim iPageCount 'The number of pages we get back
Dim iPageCurrent 'The page we want to show
Dim iRecordsShown 'Loop controller for displaying just iPageSize records
Dim I
iPageSize = 2 'since showing 2 records per page
If Request.QueryString("page"="" Then iPageCurrent=1 Else iPageCurrent=CInt(Request.QueryString("page")
set objConn=Server.CreateObject("ADODB.Connection"
objConn.ConnectionTimeout=1000
objConn.IsolationLevel=adoIsolationLevel
objConn.open "crm"
ctr=0
Set objRS=objConn.OpenSchema(adSchemaTables)
objRS.PageSize=iPageSize
objRS.CacheSize=iPageSize
' Get the count of the pages
iPageCount = objRS.PageCount
' If the request page falls outside the acceptable range,
' give them the closest match (1 or max)
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
Set objRS2=objConn.OpenSchema(adSchemaColumns)
objRS.AbsolutePage = iPageCurrent
' Start output with a page x of n line
Response.Write "<p align='left'><FONT SIZE='+1'>Page <B>" & iPageCurrent & "</B> of <B>" & iPageCount & "</B></FONT><br>"
' Show "previous" and "next" page links which pass the page to view
If iPageCurrent > 1 Then Response.Write " <a href='crmtables.asp?page=" & iPageCurrent - 1 & "'>[<< Prev]</a>"
' show page numbers:
Response.Flush
For I = 1 To iPageCount
If I = iPageCurrent Then
Response.Write " " & I
Else
Response.Write " <a href='crmtables.asp?s=1&page=" & I & "'>" & I & "</a>"
End If
Next 'I
If iPageCurrent < iPageCount Then Response.Write " <a href='crmtables.asp?page=" & iPageCurrent + 1 & "'>[Next >>]</a>"
Response.Flush
Do While ctr < iPageSize And Not objRS.EOF
If left(objRS("Table_Name",2)<>"dt" and left(objRS("Table_Name",3)<>"sys" and objRS("Table_Type"="TABLE" Then
Response.Write "<p align=left>"&objRS("Table_Name"&"<br>"
objRS2.MoveFirst
Response.flush
While Not objRS2.EOF
If objRS2("TABLE_NAME"=objRS("Table_Name" Then Response.Write " "&objRS2("Column_Name"&"<br>"
objRS2.MoveNext
Wend
Response.Write "</p>"
ctr=ctr+1
End If
objRS.MoveNext
Loop
If iPageCurrent > 1 Then Response.Write " <a href='crmtables.asp?page=" & iPageCurrent - 1 & "'>[<< Prev]</a>"
For I = 1 To iPageCount
If I = iPageCurrent Then
Response.Write " " & I
Else
Response.Write " <a href='crmtables.asp?s=1&page=" & I & "'>" & I & "</a>"
End If
Next
If iPageCurrent < iPageCount Then Response.Write " <a href='crmtables.asp?page=" & iPageCurrent + 1 & "'>[Next >>]</a>"
objRS.Close
objRS2.Close
set objRS=nothing
set objRS2=nothing
objConn.Close
set objConn=nothing
set objRS=objConn.OpenSchema(adSchemaTables)
using objRS.PageSize, objRS.CacheSize, objRS.AbsolutePage, etc.?
I set the objConn.IsolationLevel to 4096 (adoIsolationLevel).
I read that adSchemaTables returns a server-side read-only recordset of cursortype static. Is the server-side attribute what is causing it not to work? I don't get any errors when I set the absoultepage, but the same records are returned no matter what page i set it to.
What I want to do is get a list of tables and column names in my database, but some tables have lots of column so I want to page through the results instead of waiting 5 minutes for the script to finish.
Server.ScriptTimeout=480
Response.Buffer=true
Dim objConn,objRS,objRS2,ctr,temp
Const adoIsolationLevel=4096
Dim iPageSize 'How big our pages are
Dim iPageCount 'The number of pages we get back
Dim iPageCurrent 'The page we want to show
Dim iRecordsShown 'Loop controller for displaying just iPageSize records
Dim I
iPageSize = 2 'since showing 2 records per page
If Request.QueryString("page"="" Then iPageCurrent=1 Else iPageCurrent=CInt(Request.QueryString("page")
set objConn=Server.CreateObject("ADODB.Connection"
objConn.ConnectionTimeout=1000
objConn.IsolationLevel=adoIsolationLevel
objConn.open "crm"
ctr=0
Set objRS=objConn.OpenSchema(adSchemaTables)
objRS.PageSize=iPageSize
objRS.CacheSize=iPageSize
' Get the count of the pages
iPageCount = objRS.PageCount
' If the request page falls outside the acceptable range,
' give them the closest match (1 or max)
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
Set objRS2=objConn.OpenSchema(adSchemaColumns)
objRS.AbsolutePage = iPageCurrent
' Start output with a page x of n line
Response.Write "<p align='left'><FONT SIZE='+1'>Page <B>" & iPageCurrent & "</B> of <B>" & iPageCount & "</B></FONT><br>"
' Show "previous" and "next" page links which pass the page to view
If iPageCurrent > 1 Then Response.Write " <a href='crmtables.asp?page=" & iPageCurrent - 1 & "'>[<< Prev]</a>"
' show page numbers:
Response.Flush
For I = 1 To iPageCount
If I = iPageCurrent Then
Response.Write " " & I
Else
Response.Write " <a href='crmtables.asp?s=1&page=" & I & "'>" & I & "</a>"
End If
Next 'I
If iPageCurrent < iPageCount Then Response.Write " <a href='crmtables.asp?page=" & iPageCurrent + 1 & "'>[Next >>]</a>"
Response.Flush
Do While ctr < iPageSize And Not objRS.EOF
If left(objRS("Table_Name",2)<>"dt" and left(objRS("Table_Name",3)<>"sys" and objRS("Table_Type"="TABLE" Then
Response.Write "<p align=left>"&objRS("Table_Name"&"<br>"
objRS2.MoveFirst
Response.flush
While Not objRS2.EOF
If objRS2("TABLE_NAME"=objRS("Table_Name" Then Response.Write " "&objRS2("Column_Name"&"<br>"
objRS2.MoveNext
Wend
Response.Write "</p>"
ctr=ctr+1
End If
objRS.MoveNext
Loop
If iPageCurrent > 1 Then Response.Write " <a href='crmtables.asp?page=" & iPageCurrent - 1 & "'>[<< Prev]</a>"
For I = 1 To iPageCount
If I = iPageCurrent Then
Response.Write " " & I
Else
Response.Write " <a href='crmtables.asp?s=1&page=" & I & "'>" & I & "</a>"
End If
Next
If iPageCurrent < iPageCount Then Response.Write " <a href='crmtables.asp?page=" & iPageCurrent + 1 & "'>[Next >>]</a>"
objRS.Close
objRS2.Close
set objRS=nothing
set objRS2=nothing
objConn.Close
set objConn=nothing