Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

ASP GetRows Error

Posted on 2013-11-27
19
429 Views
Last Modified: 2013-11-27
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!
0
Comment
Question by:Bob Schneider
  • 9
  • 7
  • 2
  • +1
19 Comments
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 39680544
Are there 75 records in the recordset?
0
 

Author Comment

by:Bob Schneider
ID: 39680546
There are 81
0
 
LVL 25

Assisted Solution

by:Lee Savidge
Lee Savidge earned 63 total points
ID: 39680560
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 375 total points
ID: 39680569
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
 
LVL 33

Expert Comment

by:Big Monty
ID: 39680574
Easy = way

Damn auto correct :-)
0
 

Author Comment

by:Bob Schneider
ID: 39680586
            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
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 375 total points
ID: 39680863
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
 

Author Comment

by:Bob Schneider
ID: 39680936
I can do that but the problem with that is if there are no records it will throw an error, correct?
0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 375 total points
ID: 39680948
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
 

Author Comment

by:Bob Schneider
ID: 39680953
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
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 375 total points
ID: 39680987
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
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 62 total points
ID: 39681329
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
 

Author Comment

by:Bob Schneider
ID: 39681346
Where do I put that file and how do I reference it in my code?
0
 

Author Comment

by:Bob Schneider
ID: 39681353
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
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 375 total points
ID: 39681359
i assume you're looping through the array, correct? why not just use iFirstRcd as the starting point in your loop?
0
 

Author Comment

by:Bob Schneider
ID: 39681365
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
 
LVL 33

Accepted Solution

by:
Big Monty earned 375 total points
ID: 39681370
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
 

Author Comment

by:Bob Schneider
ID: 39681470
Got it.  I works if I just tell it how many records to get.  I built the start point into the query.
0
 

Author Closing Comment

by:Bob Schneider
ID: 39681476
Great discussion...very informative.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question