problems with .getrows

Discussion in 'ASP General' started by s_m_b, Mar 3, 2006.

  1. s_m_b

    s_m_b Guest

    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.
    s_m_b, Mar 3, 2006
    #1
    1. Advertising

  2. 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.
    Bob Barrows [MVP], Mar 3, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Croney69

    Using GetRows()

    Croney69, Jul 28, 2003, in forum: ASP General
    Replies:
    5
    Views:
    158
    Bob Barrows
    Jul 28, 2003
  2. Moshe

    GetRows Mystery

    Moshe, Aug 28, 2003, in forum: ASP General
    Replies:
    8
    Views:
    115
    Bob Barrows
    Aug 28, 2003
  3. Crane Linkledder

    Difference between getrows and getstring

    Crane Linkledder, Oct 29, 2003, in forum: ASP General
    Replies:
    11
    Views:
    248
    Aaron Bertrand - MVP
    Oct 30, 2003
  4. Jim

    GetRows Random <td></td> Output

    Jim, Nov 21, 2003, in forum: ASP General
    Replies:
    1
    Views:
    103
    Jeff Clark
    Nov 22, 2003
  5. Harag

    JScript & GetRows

    Harag, Dec 27, 2003, in forum: ASP General
    Replies:
    4
    Views:
    190
    The Mighty Chaffinch
    Dec 28, 2003
Loading...

Share This Page