How to do cursor handling with Delphi7 & Firebird 1.5 ?

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jft
Posts: 7
Joined: Wed 08 Nov 2006 03:22

How to do cursor handling with Delphi7 & Firebird 1.5 ?

Post by jft » Sun 12 Nov 2006 05:12

Could someone please point me in the right direction?
I have a job to do using Delphi7 to access a Firebird 1.5 database - and the CoreLabs product looks very slick and robust. I've been looking through the demo files supplied with the trial software - these illustrate nicely how to communicate with data-aware controls. I did not find one which demonstrated how to do cursor handling - for instance to run a query across a number of tables and then step through each record of the resulting recordset, loading the fields in each record into program variables and taking some action on them and then moving on to the next record and repeating the process until the end of the recordset. The sort of thing you would do if you had a database of customer details and each week you wanted to programatically send them an update by email. It would be very nice if someone could point me to some sample code or indicate how to do this please.
Cheers,
John

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Mon 13 Nov 2006 14:42

Here is the sample:

Code: Select all

var
  ID: integer;
  Name: string;
begin
  IBCQuery.SQL.Text := 'select ID, Name from sometable';
  IBCQuery.Open;
  While not IBCQuery.Eof do begin
    ID := IBCQuery.FieldByName('ID').AsInteger;
    Name := IBCQuery.FieldByName('Name').AsString;
    IBCQuery.Next;
  end;
end;

jft
Posts: 7
Joined: Wed 08 Nov 2006 03:22

Post by jft » Mon 13 Nov 2006 18:16

Challenger,
That's great - thank you very much!
Cheers,
John

Post Reply