[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

"Rowset does not support fetching backward"

Posted on 2003-11-26
6
Medium Priority
?
1,516 Views
Last Modified: 2008-01-09
I'm using the following code in my ASP page:

Dim myConnString
Dim myConnection
Dim mySQL
      
myConnString = Application("PIA27_ConnectionString")
Set myConnection = Server.CreateObject("ADODB.Connection")

myConnection.Open myConnString

...

dim mySQL2
mySQL2 = "SELECT * FROM PIATable"
Set rs = myConnection.Execute(mySQL)
rs.movelast
do until rs.bof
response.write("blah blah")
rs.moveprevious
loop

*****
But when I view it in the browser, I get "Rowset does not support fetching backwards." It works fine if I change the code to move forward through the record set.

What do I need to change or add to get this code to work?

Thanks in advance--

Kathryn
0
Comment
Question by:KathrynGZ
[X]
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
  • 3
  • 2
6 Comments
 
LVL 25

Expert Comment

by:Rouchie
ID: 9829617
You need to declare a cursor type in your connection strings.  This occupies more memory on the server when queries are done, but allows more freedom in the results retrieved.

I'm a bit rusty, but something like this should do the trick;


Set myConnection = Server.CreateObject("ADODB.Connection")

' declare cursor type here before opening
myConnection.CursorType = adOpenStatic

...rest of code
0
 
LVL 3

Accepted Solution

by:
vijay7248 earned 600 total points
ID: 9829841
Hi,
myConnection.Execute(mySQL) is a ForwardOnly cursor and it does not support backward fetching.

Replace the line
         Set rs = myConnection.Execute(mySQL)
with ...
           rs.Open mySQL,myConnection,1,2

where 1 - adOpenKeyset
and 2 - adLockPessimistic

For more datails on the ADO constants please have a look at the adovbs.inc file...

Or else check this out..

http://www.codeguru.com/forum/showthread.php?threadid=266073

-Vijay

0
 
LVL 3

Expert Comment

by:vijay7248
ID: 9829984
KathrynGZ,

Do you need any more help??
Jus wondering whether your prob is solved or not

-Vijay
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:KathrynGZ
ID: 9851887
Hi Vijay,

Just got back to work after the vacation and got your solution. This is how I implemented it (hope I understood you correctly as far as the 1,2--I'm in the process of learning VBScript):

dim mySQL2
mySQL2 = "SELECT * FROM PIATable"
'Set rs = myConnection.Execute(mySQL)
rs.Open mySQL,myConnection,adOpenKeyset,adLockPessimistic
rs.movelast
do until rs.bof
response.write("blah blah")
rs.moveprevious
loop

But I got this error:

ADODB.Recordset error '800a0e79'
Operation is not allowed when the object is open.

Any suggestions?  Thanks--

Kathryn
0
 

Author Comment

by:KathrynGZ
ID: 9853802
Just figured it out--a previous rs wasn't closed. So Vijay, your answer worked. Thanks much!

Kathryn
0
 
LVL 3

Expert Comment

by:vijay7248
ID: 9855750
Sorry I couldn't help you out.I was at home yesterday.
Great to know you have got that to work.

-Vijay
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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