Page 1 of 1

How to do cursor handling with Delphi7 & Firebird 1.5 ?

Posted: Sun 12 Nov 2006 05:12
by jft
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

Posted: Mon 13 Nov 2006 14:42
by Challenger
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;

Posted: Mon 13 Nov 2006 18:16
by jft
Challenger,
That's great - thank you very much!
Cheers,
John