473,322 Members | 1,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

ASP getRows problem - Requested operation requires a current record

83
Hi,

This is very strange...

I have a simple query using a recordset thus...
Expand|Select|Wrap|Line Numbers
  1.  
  2. set rsID = CreateObject("ADODB.recordset") 
  3. searchPhrase = "SELECT blah...."
  4. rsID.Open searchPhrase, oConn
  5.  
  6. If NOT (rsID.eof AND rsID.bof) then
  7. myArray = rsID.getRows()
  8. End If
  9.  
Occasionally this code generates an error on the myArray line as follows...

'Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record'

How is that possible since i've already made that check before calling getRows ???

Any help would be much appreciated !

Thanks.
Jun 2 '08 #1
5 5281
DrBunchman
979 Expert 512MB
Hi TimSki,

When this error occurs have you been able to see whether there is anything different about this recordset - e.g. does it contain zero rows?

Have you been able to recreate the error at will?

Dr B
Jun 2 '08 #2
TimSki
83
Hi Dr B,

Thanks for your reply.

I thought the eof/bof check confirms it has no rows....

So far i haven't been able to recreate this at will.
Jun 2 '08 #3
DrBunchman
979 Expert 512MB
I thought the eof/bof check confirms it has no rows....
Yes it should but while we don't know what's behind the error it makes sense to check all the circumstances that may be causing it.

If you could run the query generated by your code in Query Analyzer or similar you would be able to see whether a recordset is being returned or not. If it isn't then it may suggest that your EOF or BOF check is not working properly.

If a recordset is being returned by the query then perhaps the problem lies with the getRows line. You could comment that out and try a simple Response.Write rsID("value1") instead and see if that errors.

Dr B
Jun 2 '08 #4
jhardman
3,406 Expert 2GB
I believe if you type it this way "if not (rs.eof AND rs.bof)" you evaluate false only if you have both EOF and BOF at the same time, and that will never happen. Try instead:
Expand|Select|Wrap|Line Numbers
  1. if not rs.eof and not rs.bof
or
Expand|Select|Wrap|Line Numbers
  1. if rs.eof or rs.bof
  2.    response.write "no records returned"
  3. else
  4.    myArray = rsID.getRows()
  5. end if
let me know if this helps.

jared
Jun 5 '08 #5
TimSki
83
thanks for all your help. I've made the changes you suggest which will hopefully solve the problem.
Jun 6 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Croney69 | last post by:
I am getting information out of a table to place into to an Array. rs=DataConn.Execute(strSQL) At this point I place it into the array objArray=rs.GetRows() But how do I handle things if...
4
by: Harag | last post by:
Hi All I currently thinking of converting from my little knowledge of VBscript to jScript ASP. With this in mind I'm looking at my current code to see how it will convert over to Jscript. ...
11
by: Laphan | last post by:
Hi All I'm using .getRows() with a local var array instead of doing a recursive loop so that I'm being a good ASP newvbie and closing my object i/o's (the recordset in this case) as quick as...
9
by: bajopalabra | last post by:
hi session("myVar") = rs.getRows( ) don't work when number of records is greater than 10 does anybody know WHY ??? is it a Session object limitation ??? thanks
5
by: Ankit Aneja | last post by:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the Application Block I configured the DAAB using the Enterprise Library Configuration now this is the error which is coming ...
10
by: Hank | last post by:
Hello, I'm having trouble reading from a table directly into an array using Access 2000. Dim db As Database Dim rsTime As Recordset Dim TimeArray As Variant Set db = CurrentDb Set rsTime =...
4
by: liz0001 | last post by:
I have an MSAccess database that is updated by multiple users. I am searching for particular records. Sometimes the search works, and sometimes it errors out. I have been at this for a long time...
9
ADezii
by: ADezii | last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows()...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.