Solved

TAdoQuery Not Updating All Records at runtime

Posted on 2003-10-21
6
160 Views
Last Modified: 2010-08-05
I have a form with a TAdo Query.  When you click the button it scrolls through the table and then updates the record.. Or so it should.  e.g.  when running the first record only is updated.  If stepping through in debug/IDE then All records are correctly updated.

Using D7 connecting to Access Database.  HELP PLEASE..

   While not qryDataToCheck.Eof do
     Begin
       //Scroll Through the fields and do the checks on them

       while not cdCheckData.Eof do
         Begin
      {OMITTED bOk False if error found}
       qryDataToCheck.Edit;
       if  Not bOk then
           begin
             if bError then
                  qryDataToCheck.FieldByName('Data_Error_Found').Value := 'E'
             else qryDataToCheck.FieldByName('Data_Error_Found').Value := 'W';
            end
        else
           begin
           qryDataToCheck.FieldByName('Data_Error_Found').Value :=  Null ;
            end;
        qryDataToCheck.FieldByName('Data_Error_Comment').Value := sRecordError;

        qryDataToCheck.Post;
        qryDataToCheck.Next;
      end; //loop qryDataToCheck.eof
0
Comment
Question by:Icart
[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
6 Comments
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 9597634
It could be a timer-related issue. Maybe without the debugger running, the updates are too fast for Access to handle correctly. Then again, looking at your code extract, I noticed that the last end has a wrong comment. It is related to cdCheckData.Eof and not qryDataToCheck.Eof. So perhaps the problem is related to table-name confusion in your code.
0
 

Expert Comment

by:hetturki
ID: 9597871
first of all why you dont use UPDATE SQL like
Update TableName
set field1 = pla pla , .....
where <condition>

second
try to close the table at end of the procedure the makes the updates to your
table

Best Regards
0
 

Author Comment

by:Icart
ID: 9601414
Apologise for the cdCheckData and The qryDataToCheck loopy bit.  I am actually opening because I omitted code i didn't clip the correct do while..  The code runs perfectly as I say in IDE if I put a break in and then continue.. I have tried put sleep() command before the post and a process messages.  The query rescordset state is open and not executing or fecthing and I am running out of ideas.
0
 

Author Comment

by:Icart
ID: 9776130
I solved it.. Damn ADOQuery's.  I changed the query to a Client Dataset and the code worked FINE!!!  
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12328370
PAQed, with points refunded (125)

Computer101
E-E Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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