Solved

EOF/BOF Error - ADOQuery related?

Posted on 2004-03-23
5
599 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 125 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy file in dll not working but working on exe ! 18 93
Printing problem 2 95
control image tags in a string ? 12 132
JAudiorecorder record freezing the app 29 67
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

809 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