Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

EOF/BOF Error - ADOQuery related?

Posted on 2004-03-23
5
Medium Priority
?
656 Views
Last Modified: 2013-11-23
Hi all,

First time I've had to post but I'm stumped!! I'm a reasonably experienced Delphi programmer but NOT with database based scripts - so this could well be something really stupid.

The script below produces the standard EOF/BOF error when run. The basic idea is that an Access database is read and used to populate a TTreeview component. There are 2 tables - TTypes and Treg. TTypes provides the parents and related records in TReg provide the children. All is fine so long as each TType has a corresponding child record in TReg, but if the ADOQuery component returns no results then an error occurs when it is closed in preparartion to redefine its SQL for the next query.

In the code snippet the DB2Tree procedure is run first.

So what have I done wrong??

All help really really appreciated!!!

//<---------start code snippet

procedure TFrmMain.buildreg;

begin

 

with mainQuery do

 begin

  close;

  SQL.clear;

  SQL.Add('SELECT TReg.Registration, TReg.Type FROM TReg WHERE (((TReg.Type)="'+parentreg.text+'"))');

   open;

  end;

   

  mainQuery.First;

 

 while not mainQuery.eof do

  begin

   parentcomp:=treedb.Items.AddChild(parentreg,  mainQuery.fieldbyname('Registration').asstring);

   mainQuery.next;

  end;

 end;

 

end;

 

procedure TfrmMain.DB2Tree;

//procedure to read the contents of the database to the tree

var

  NodeText : String;

  NextNode, NodeChild : TTreeNode;

begin

  NextNode := treedb.TopItem;

  while NextNode <> nil do

  begin

   NodeText := NextNode.Text;

    if UpperCase(NodeText) = UpperCase('Aitcraft Types') then

    begin
 
0
Comment
Question by:rockrockmcrock1
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10659141
get the latest update from borland (in case u use d5)
get the latest mdac from microsoft

meikl ;-)
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 500 total points
ID: 10659160
0
 

Author Comment

by:rockrockmcrock1
ID: 10660740
Wow, fast reponse cheers.

Well I can't say I wouldn't be glad if it was that coz then it wouldn't be my programming skills ;) and yep, I'm using an old delphi 5 as a stop gap until I get delphi 8. However, I thought ADO and ADOExpress were two seperate sets of components? I'm using ADO as far as I know does the error still effect this?

Won't be able to check it out till tomorrow so it would put my mind at rest. . . .!
0
 

Author Comment

by:rockrockmcrock1
ID: 10666282
Check solution and you're spot on - my compliment sir!!!
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10667658
glad to helped you :-))
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview

927 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