?
Solved

Movelast gives 'Rowset does not support fetching backward'

Posted on 2003-03-04
10
Medium Priority
?
1,822 Views
Last Modified: 2012-06-27
The following doesn't work, although it is not a forward-only cursor.

set Conn=Server.Createobject("ADODB.Connection")
Conn.open Application("ConnectionString") ' Works fine throughout my software
 
set rstAllReceipts = Server.CreateObject("ADODB.RecordSet")

strQuery = "(select 1 as code, stack_detail_id as id_no from stack_detail where unit_no = 'U1') union (select 2, internal_movement_id from internal_movement where toUnit_no = 'U1') order by 1,2"

rstAllReceipts.open strQuery, conn, 1, 3  ' Tried with 2,3 too

rstAllReceipts.MoveLast

' The Movelast statement gives the error "Rowset does not support fetching backward"

If I modify my SQL statement to "select * from stack_detail order by unit_no" then it works fine.

Kindly suggest me solution.

Tarun.
0
Comment
Question by:tknayak123
[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
  • 3
  • 2
  • +2
10 Comments
 
LVL 7

Expert Comment

by:markhoy
ID: 8064000
0
 
LVL 2

Expert Comment

by:AccessHelpNet
ID: 8066245
Try using a static cursor :

rstAllReceipts.open strQuery, conn, 3, 3

You may also wish to test rstAllReceipts.eof before calling rstAllReceipts.MoveLast

best regards,

Dave Kawliche
http://AccessHelp.net
http://1ClickDB.com
0
 
LVL 4

Expert Comment

by:Wakie
ID: 8068492
tknayak123, try this:

set Conn = Server.Createobject("ADODB.Connection")
Conn.open Application("ConnectionString")' Works fine throughout my software

strQuery = "(select 1 as code, stack_detail_id as id_no from stack_detail where unit_no = 'U1') union (select 2, internal_movement_id from internal_movement where toUnit_no = 'U1') order by 1,2"

set rstAllReceipts = Conn.Execute(strQuery)
rstAllReceipts.MoveLast

Regards,
Wakie.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:tknayak123
ID: 8069750
I have read the comments posted by Dave Kawliche and Wakie. Thak you. I have tried both the methods. But it is still not working. I am already checking for rstAllReceipts.EOF. It is fetching some 100 records anyway. In the beginning I am able to movenext and movefirst after that, which means it is not forwardonly. Furthermore it is working with simple queries, but why not with this one? I am using the SQL server driver provided by Windows.

Tarun.
0
 
LVL 4

Expert Comment

by:Wakie
ID: 8069770
Are you getting the same message or a different message?
0
 

Author Comment

by:tknayak123
ID: 8069829
Yes I am getting the same message "Rowset does not support fetching backward". It happens only when I give movelast statement.
0
 
LVL 4

Expert Comment

by:Wakie
ID: 8070086
From MSDN:

MoveLast
This method makes the last row active.

recordset.MoveLast
Parameters
None.

Return Values
None.

Remarks
Use the MoveLast method to move the current record position to the last record in the recordset.

Support for this method varies depending on the OLE DB provider.

This method may not be supported in some recordsets.

====

Having read that, it might be a good idea if you could paste your connection string.

Cheers,
Wakie.
0
 

Author Comment

by:tknayak123
ID: 8070216
I have tried with the following connection strings.
1. DRIVER={SQL Server}; DATABASE=FCI_Depo;SERVER=FCADBS;UID=sa;PWD=
2. Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=FCI_Depo;Data Source=FCADBS
3. Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Extended Properties='Description=FCI Depot;DRIVER=SQL Server;SERVER=(local);UID=sa;APP=Microsoft Open Database Connectivity;WSID=FCADBS;DATABASE=FCI_Depo';Initial Catalog=FCI_Depo
0
 
LVL 2

Accepted Solution

by:
AccessHelpNet earned 80 total points
ID: 8072580
It should actually be a client-side static cursor, try this :

rstAllReceipts.CursorLocation = 3

rstAllReceipts.open strQuery, conn, 3, 3

rstAllReceipts.MoveLast

And definitely use the oledb connect string :

Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=FCI_Depo;Data Source=FCADBS

best regards,

Dave Kawliche
http://AccessHelp.net
http://1ClickDB.com
0
 
LVL 58

Expert Comment

by:Gary
ID: 9352649
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by AccessHelpNet

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

752 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