473,791 Members | 2,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP getRows problem - Requested operation requires a current record

83 New Member
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 5326
DrBunchman
979 Recognized Expert Contributor
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 New Member
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 Recognized Expert Contributor
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 Recognized Expert Specialist
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 New Member
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
8179
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 the rs came back blank?
4
5865
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. One thing I have spotted that I can't think of a way round is the ADO recordset.GetRows command.
11
3520
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 possible. My problem is that I can't seem to use this to complete good effect because the IsArray statement doesn't seem to work with a local var array that has or has not been populated with the .getRows() property.
9
3663
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
9784
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 Security Exception Description: The application attempted to perform an operation not allowed
10
26315
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 = db.OpenRecordset("Time Record")
4
1780
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 and I just can't figure it out. Does anyone have any suggestions? Here is my code: ___ sqlSearchQuery = "SELECT DishID, DishName, TypeID, UserID, RecipeText FROM Recipe WHERE DishName LIKE '%" & SearchTerm & "%' AND Private = False ORDER BY...
9
35559
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() Method of the Recordset Object. This Method varies slightly from DAO to ADO, so for purposes of this discussion, we'll be talking about DAO Recordsets. The ADO approach will be addressed in the following Tip. We'll be using a Query, consisting of 5...
3
43539
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 (GetRows()), but only as it applies to an ADO Recordset. Although there are similarities in the 2 methodologies, the ADO Method offers 2 more Optional Arguments, is a little more complex, and of course, the syntax is different in creating the...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9995
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.