problems with .getrows

S

s_m_b

I have two similar pages that pull the same data from a table and display
a range of it, based on 'number per page', so that users can quickly scan
and find a record.
On the original page, the code works fine:
''''''''''''''
NoUsersFlag = false
set rs = Server.CreateObject ("ADODB.Recordset")
rs.pagesize = perpage
rs.cachesize = perpage
Rs.CursorType = 3
Rs.LockType = 1
rs.open sql , conn, 3, 1 ,&H0001
if not rs.eof then
rs.movelast
rowcnt = rs.absoluteposition
rs.movefirst
end if
If PerPage = "" or (len(PerPage)>0 and not isnumeric(PerPage)) Then
PerPage = 10
If PageNum = "" or (len(PageNum)>0 and not isnumeric(PageNum)) Then
PageNum = 1
PerPage = clng(PerPage)
PageNum = clng(PageNum)
PageCnt = RowCnt \ PerPage
if RowCnt mod PerPage <> 0 then PageCnt = PageCnt + 1
if PageNum < 1 Then PageNum = 1
if PageNum > PageCnt Then PageNum = PageCnt

if not rs.eof then
rs.absolutepage = pagenum
rstart = rs.absoluteposition
rstop = rstart + (perpage-1)
'set rs = conn.execute(sql)
i=0
do while i < perpage and not rs.eof
'do while not rs.eof
strusername = replace(rs(2),"'","%27")
struserfname= replace(rs(1),"'","%27")
'userid,view,groupid,sfocus, mode
Response.Write ("<a href=""#"" onClick=""view('" &
rs(1) & "','" & view & "','" & groupid & "','" & focus & "','" & mode &
"');return false;"" >"&rs(0)&"</a><br/>" & vbLf)
rs.movenext
i = i+1
loop
else
Response.Write ("<p>No users in the group selected</p>" &
vblf)
NoUsersFlag = true
end if
''''''''''
on the second page, which displays the same stuff, just stripped down a
lot, the only response I get from the recordset is -1 for the
absoluteposition, which points to the wrong cursor/lock type.

how can this be, since the same core code is used ?
I did try experimenting with the
'''''
rs.open sql , conn, 3, 1 ,&H0001
'''
line (in the working page) but switching to '3, 3' caused the same -1
absoluteposition value.

I'm baffled by this behaviour.
 
B

Bob Barrows [MVP]

s_m_b said:
I have two similar pages that pull the same data from a table and
display a range of it, based on 'number per page', so that users can
quickly scan and find a record.
On the original page, the code works fine:
rs.open sql , conn, 3, 1 ,&H0001
'''
line (in the working page) but switching to '3, 3' caused the same -1
absoluteposition value.

I'm baffled by this behaviour.

Well, it's a good thing this is happening now since this is not a very
efficient technique. see this for alternatives:
http://www.aspfaq.com/show.asp?id=2120

At the very least, you should switch to using a clientside disconnected
cursor by setting the recordset's CursorLocation property to adUseClient and
setting the ActiveConnection property to Nothing after opening the
recordset.

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top