View Full Version : Recordset.Previous
ecnarongi
10-28-2002, 09:58 PM
I have a script that goes the the next record fine but when I want to go to the previous record it gives me this error:
ADODB.Recordset error '800a0c93'
Operation is not allowed in this context.
I used the movenext method to go the the next record w/o any problems and I used moveprevious to try to get the previous record. All help is appreciated.
Roy Sinclair
10-28-2002, 10:46 PM
MovePrevious isn't going to work if you've declared (or defaulted) to a Forward-Only cursor for your recordset.
ecnarongi
10-28-2002, 10:47 PM
I know that the Recordset object must support bookmarks or backward cursor movement; otherwise, the method call will generate an error. So I am using adOpenDynamic, I am baffled. All help is appreciated. Thanks
waj_muller
10-29-2002, 07:16 AM
Use adOpenStatic that should solve the problem.
Remember that the cursor will not move backwords unless you specify the cursor to always be on the current record.
Try doing a recordset count,if you get -1 you know the cursor is incorrect.
If it returns a valid number you are on the right track........
ecnarongi
10-29-2002, 05:56 PM
Thanks Maj but everything I attempt is not working, I wrote this just to see what I am doing wrong maybe u can help me.
<%@ Language=VBScript %>
<% Response.Buffer = True %>
<%
aConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=MyCarDealership.mdb"
SQLlookup = "SELECT * FROM prepress"
Set connList = server.createobject("ADODB.Connection")
connList.ConnectionString = aConnectionString
connList.open
Set results = server.createobject("ADODB.Recordset")
results.open SQLlookup, connList, adOpenStatic
Dim i
i = 0
do until results.EOF
response.write i & "<br>"
i = i + 1
results.movenext
loop
response.write "I am at last" & "<br>"
Do until results.BOF
response.write i
i = i - 1
results.moveprevious
loop
results.close
Set results = nothing
connList.close
Set connList = nothing
%>
<% Response.End %>
and I still get the same error as above. If you can't see a problem with this code can u post a snipet of code that u know works so I can see if its my server?? Thanks, all help is greatly appreciated.
waj_muller
10-30-2002, 07:03 AM
Try this one.Remember to include the damm adovbs file,i made the mistake of not at first and got the same error you did.
Check the link at the bottom.
I dont use a connection i use the default connection properties for the recordset to open it for me but that wont matter.
<!--#include file="admin/adovbs.inc"-->
<%
set orec=server.CreateObject ("adodb.recordset")
orec.ActiveConnection ="DSN=;UID=sa;pwd=;"
orec.Source ="select * from "
orec.CursorType = adOpenStatic
orec.Open
%>
<html>
<head>
<title>Test ASP Page</title>
</head>
<body>
<%
Dim i
i = 0
do while not orec.EOF
response.write i & "<br>"
i = i + 1
orec.movenext
loop
response.write "I am at last" & "<br>"
orec.MovePrevious
Do while not orec.BOF
response.write i &"<br>"
i = i - 1
orec.MovePrevious
loop
%>
</body>
</html>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthmovefirstvbscriptx.asp
ecnarongi
10-30-2002, 02:47 PM
YOU HAVE TO BE KIDDING ME! I was recking my brain for a day and a half and to include a meta tag was all it took. Thank you soo much. :thumbsup:
waj_muller
10-31-2002, 06:52 AM
That one got me too..LOL
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.