ASP GetRows Error

I am getting this error: Bookmark is invalid.

On this line:         IndRslts = rs.GetRows(iNumRcds, iFirstRcd)

It works fine if I take the parameters out.  iNumRcds = 75 and iFirstRcd = 1 in this case.

Thanks!
Bob SchneiderCo-OwnerAsked:
Who is Participating?
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
then that should be done directly in your sql query. you should only return the data that you're going to need for the page, and no more. how many records get returned?
0
 
Lee SavidgeCommented:
Are there 75 records in the recordset?
0
 
Bob SchneiderCo-OwnerAuthor Commented:
There are 81
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
Lee SavidgeCommented:
Hmm, actually it shouldn't matter eitehr way. If there are less then it will return all of them.

iFirstRcd should be a string and not an integer.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
I'm guessing it has to do with the easy you're handling the cursor when you open the record set. Can you post your code for that?
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
Easy = way

Damn auto correct :-)
0
 
Bob SchneiderCo-OwnerAuthor Commented:
            sql = "SELECT pr.Bib, p.FirstName, p.LastName, p.Gender, pr.Age, ir.ChipTime, ir.FnlTime, ir.ChipStart, p.City, p.St "
            sql = sql & "FROM Participant  p INNER JOIN IndResults ir ON p.ParticipantID = ir.ParticipantID "
            sql = sql & "INNER JOIN PartRace pr ON pr.ParticipantID = p.ParticipantID "
            sql = sql & "INNER JOIN RaceData rd ON rd.RaceID = pr.RaceID AND rd.RaceID = ir.RaceID "
            sql = sql & "WHERE ir.RaceID = " & lRaceID & " AND ir.FnlTime IS NOT NULL ORDER BY ir.ChipTime"
        Else
            sql = "SELECT pr.Bib, p.FirstName, p.LastName, p.Gender, pr.Age, ir.ChipTime, ir.FnlTime, ir.ChipStart, p.City, p.St "
            sql = sql & "FROM Participant  p INNER JOIN IndResults ir ON p.ParticipantID = ir.ParticipantID "
            sql = sql & "INNER JOIN PartRace pr ON pr.ParticipantID = p.ParticipantID "
            sql = sql & "INNER JOIN RaceData rd ON rd.RaceID = pr.RaceID AND rd.RaceID = ir.RaceID "
            sql = sql & "WHERE ir.RaceID = " & lRaceID & " AND p.Gender = '" & sGender & "' AND ir.FnlTime IS NOT NULL ORDER BY ir.ChipTime"
        End If

        Set rs = Server.CreateObject("ADODB.Recordset")
        rs.Open sql, conn, 1, 2
        IndRslts = rs.GetRows(iNumRcds, iFirstRcd)
        rs.Close
        Set rs = Nothing

Open in new window

0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
just as a test and before we dive too far into cursors, can you try changing:

rs.Open sql, conn, 1, 2

to

set rs = conn.Execute( sql )
0
 
Bob SchneiderCo-OwnerAuthor Commented:
I can do that but the problem with that is if there are no records it will throw an error, correct?
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
if that is a concern, then you could always check before doing getRows():

if not rs.BOF and not rs.EOF then
    IndRslts = rs.GetRows(iNumRcds, iFirstRcd)
end if
0
 
Bob SchneiderCo-OwnerAuthor Commented:
Here's what I got: Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
ok, I thought that may happen, but just wanted to make sure :)

can you try the following code?

rs.CursorLocation =  adUseServer
rs.Open sql, conn, adOpenDynamic, adLockReadOnly, adCmdText

you'll need adodb.inc to get all of the CONSTANTS values, which you can download from

http://www.4guysfromrolla.com/webtech/code/adovbs.txt

rename it to a ".inc" extension and include it before the code
0
 
Anthony PerkinsCommented:
I am getting this error: Bookmark is invalid.
Here is the reason you are getting the error:
If the Recordset object supports bookmarks, you can specify at which record the GetRows method should begin retrieving data by passing the value of that record's Bookmark property in the Start argument.

Both:
rs.Open sql, conn, 1, 2
and
set rs = conn.Execute( sql )
Do not support book marks.  You can confirm this by checking the value for rs.Supports(adBookmark)
0
 
Bob SchneiderCo-OwnerAuthor Commented:
Where do I put that file and how do I reference it in my code?
0
 
Bob SchneiderCo-OwnerAuthor Commented:
Ok so how can I make this work?  I really want to be able to tell the db where to start and how many  records to et.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
i assume you're looping through the array, correct? why not just use iFirstRcd as the starting point in your loop?
0
 
Bob SchneiderCo-OwnerAuthor Commented:
I can do that but I am trying to minimize the resource drain and I figured I could just tell it where to start and how many records to get and that would be quicker.  No?
0
 
Bob SchneiderCo-OwnerAuthor Commented:
Got it.  I works if I just tell it how many records to get.  I built the start point into the query.
0
 
Bob SchneiderCo-OwnerAuthor Commented:
Great discussion...very informative.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.