Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Rowset does not support fetching backward. MS Access 2007 and Javascript

Posted on 2010-09-16
5
Medium Priority
?
531 Views
Last Modified: 2012-05-10
Experts,

So I have a Javascript function that I am using to connect to MS Access 2007 dynamically using HTML DOM. Whenever I reach the end of the record set and I move to the previous record, I get an error:

"Rowset does not support fetching backward." Please help fix it!
function fnLoad()	{ 
  strConnect = "DSN=QTPDSN";
  oConn = new ActiveXObject("ADODB.Connection");
  oConn.Open(strConnect);
  rs.CursorType = adOpenDynamic;
  rs.LockType = adLockPessimistic;
  rs.CursorLocation = adUseClient;
  rs=oConn.Execute("SELECT * from PolicyInfo where RCApplied = '" + gRCApplied + "'");
  rs.MoveLast; 
}

Open in new window

0
Comment
Question by:DoofuS
[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
  • 4
5 Comments
 
LVL 11

Accepted Solution

by:
datAdrenaline earned 2000 total points
ID: 33698199
The recordset that .Execute returns will only be read-only with a forward-only cursor.  You will want to use the .Open method of the Recordset object, then you will be able to control the .CursorType etc. (like you are attempting to do) in order to get the ability to traverse forward and backward.

PS> Why the .MoveLast?
0
 
LVL 11

Expert Comment

by:datAdrenaline
ID: 33698242
Example line of code (note I am not a Java programmer .. so cut some slack please :) :

function fnLoad()      {
  strConnect = "DSN=QTPDSN";
  oConn = new ActiveXObject("ADODB.Connection");
  rs = new ActiveXObject("ADODB.Recordset");
  oConn.Open(strConnect);
  rs.ActiveConnectio = oConn;
  rs.CursorType = adOpenDynamic;
  rs.LockType = adLockPessimistic;
  rs.CursorLocation = adUseClient;
  rs.Source = "SELECT * from PolicyInfo where RCApplied = '" + gRCApplied + "'";
  rs.Open;
  rs.MoveLast;
}

Also, note that you can pass several arguments in the .Open method ... here is the prototype for the .Open method:

recordset.Open Source, ActiveConnection, CursorType, LockType, Options

More info can be found here:
http://msdn.microsoft.com/en-us/library/ms675544(VS.85).aspx
0
 
LVL 11

Expert Comment

by:datAdrenaline
ID: 33698251
This ...
rs.ActiveConnectio = oConn

Should be ...
rs.ActiveConnection = oConn

That "Air Code" debugger is not so good at catching typos! :)
0
 

Author Closing Comment

by:DoofuS
ID: 33864320
Sorry for accepting your answer late...got caught up. Thanks
0
 
LVL 11

Expert Comment

by:datAdrenaline
ID: 33886115
Your welcome! .. Thank you for following up.  Good luck with your project!
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
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…

705 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