Solved

EOF/BOF Error - ADOQuery related?

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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