RE: Another TQuery to TADOQuery migration problem

Angus Macdonald <[email protected]>
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <8281693F9EF2B140AA145EE9BE4675A6042EBD63@nwwmail1.nww-tr.wales.nhs.uk>
Update!
The failure occurs on 
 
while not adoquery1.eof do begin
 
after the final record has been retrieved, not on adoquery1.next as I
stated.
So, adoquery1.eof is false until I step past the final record in the table,
at which point it becomes true and the "while not adoquery1.eof" line causes
an exception.

-----Original Message-----
From: Angus Macdonald [mailto:[email protected]]
Sent: 21 July 2003 13:48
To: [email protected]
Subject: [Delphi] Another TQuery to TADOQuery migration problem


Thank you Tameem. I don't know how I managed to miss that combination.

Now, onto the next issue. The code below works fine:

    query1.sql.clear;
    query1.sql.add(sqlgetshareremaps);   {share remapping function}
    query1.open;
    query1.first;
    while not query1.eof do begin

shareremaps:=shareremaps+query1.fieldbyname('remapfrom').text+'^'+query1.fie
ldbyname('remapto').text+'#';
      query1.next;
      end;
    query1.close;

While the code adapted for TADOQuery (below) fails on the final iteration of
ADOQuery1.Next ie after all 5 (in this case) table entries have been
retrieved

    adoquery1.sql.clear;
    adoquery1.sql.add(sqlgetshareremaps);   {share remapping function}
    adoquery1.open;
    adoquery1.first;
    while not adoquery1.eof do begin

shareremaps:=shareremaps+adoquery1.fieldvalues['remapfrom']+'^'+adoquery1.fi
eldvalues['remapto']+'#';
      adoquery1.next;
      end;
    adoquery1.close;

The error in the NT Event log (the app is a service so there are no UI
messages) is 
"Either BOF or EOF is true, or the current record has been deleted.
Requested operation requires a current record"

Can anyone shed some light on this one?
Regards
Angus


Yahoo! Groups Sponsor	

ADVERTISEMENT
 
<http://rd.yahoo.com/M=244522.3512152.4794593.1261774/D=egroupweb/S=17051153
62:HM/A=1595056/R=0/SIG=124bf4lrb/*http://ashnin.com/clk/muryutaitakenattogy
o?YH=3512152&yhad=1595056> Click Here!	
 
<http://us.adserver.yahoo.com/l?M=244522.3512152.4794593.1261774/D=egroupmai
l/S=:HM/A=1595056/rand=436081046> 	

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
<http://www.delphicollection.com/public/CodeCoffer.htm> 
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 




[Non-text portions of this message have been removed]


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges & Refill Kits for Your Epson at Myinks.com
Free shipping on orders $50 or more to the US and Canada.
http://www.c1tracking.com/l.asp?cid=5705&lp=home/epson.asp
http://us.click.yahoo.com/brYXfA/_xWGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.