473,467 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problems with .getrows

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.
Mar 3 '06 #1
1 1310
s_m_b wrote:
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: <snip> 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

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Mar 3 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Croney69 | last post by:
I am getting information out of a table to place into to an Array. rs=DataConn.Execute(strSQL) At this point I place it into the array objArray=rs.GetRows() But how do I handle things if...
8
by: Moshe | last post by:
I'm facing an odd behavior in using the GetRows Method. I'm not sure what's causing it because it has been working fine until now. I have a sproc that returns 1 row. I display the RS info on the...
4
by: Harag | last post by:
Hi All I currently thinking of converting from my little knowledge of VBscript to jScript ASP. With this in mind I'm looking at my current code to see how it will convert over to Jscript. ...
11
by: Laphan | last post by:
Hi All I'm using .getRows() with a local var array instead of doing a recursive loop so that I'm being a good ASP newvbie and closing my object i/o's (the recordset in this case) as quick as...
9
by: bajopalabra | last post by:
hi session("myVar") = rs.getRows( ) don't work when number of records is greater than 10 does anybody know WHY ??? is it a Session object limitation ??? thanks
10
by: Hank | last post by:
Hello, I'm having trouble reading from a table directly into an array using Access 2000. Dim db As Database Dim rsTime As Recordset Dim TimeArray As Variant Set db = CurrentDb Set rsTime =...
3
by: colm1974 | last post by:
Hi, I hope somebody can help. I have been trying to use the GetRows method but it only seems to work when there are no constants assigned. aGetElement = rs_zgl_element.GetRows() This works and...
1
by: FrozenDude | last post by:
Help! I'm a VBA newbie and am having trouble getting the array values retrieved from getRows into a series of individual variables. Here is the query: "Select parcelID, DueDate from tablename" ...
9
ADezii
by: ADezii | last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows()...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.