Solved

EOF/BOF Error - ADOQuery related?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
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 …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now