Solved

EOF/BOF Error - ADOQuery related?

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 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

10 Experts available now in Live!

Get 1:1 Help Now