[DUG] Importing Data

Bob Pawley rjpawley at shaw.ca
Wed Nov 7 06:29:23 NZDT 2007


Hi

In my pursuit of learning at least some Delphi, I have this challenge for which I would appreciate some help.  

I am having a little difficulty with this part of an expression-

       while not PSQLQuery1.EOF do
        begin
      i := TIntegerField ;
      i.value:= PSQLQuery1.FieldByName('Count').AsInteger ;
      Edit1.Text(Integer);

I am importing data from a PostgreSQL database and processing the information one row at a time. It works quite well as far as I have gone. I want to control the process by taking the count of the rows left unprocessed (greater than zero) before importing the next row.

The full expression follows -

Bob Pawley

var 
i : integer

      begin
         PSQLQuery1.Close;
      PSQLQuery1.SQL.Clear;
      PSQLQuery1.SQL.Add ('Select Count (Loop_ID)');
      PSQLQuery1.SQL.Add ('FROM P_ID.Loops, Project.Project');
      PSQLQuery1.SQL.Add ('Where P_ID.Loops.IDW_Loop_ID is null');
      PSQLQuery1.SQL.Add ('and P_ID.Loops.P_ID_ID = Project.Project.P_ID_ID');
      PSQLQuery1.SQL.Add ('and Project.Project.P_ID_Name = :P_ID_Name ') ;
      PSQLQuery1.ParamByName('P_ID_Name').AsString := DBEdit2.Text;
      PSQLQuery1.Prepare;
      PSQLQuery1.Open;
      PSQLQuery1.First ;
           while not PSQLQuery1.EOF do
        begin
      i := TIntegerField ;
      i.value:= PSQLQuery1.FieldByName('Count').AsInteger ;
      Edit1.Text(Integer);
     while i >0 do

     BitBtn1MouseUp2(Sender, Button, Shift, X, Y);
       PSQLQuery1.Next;


        end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20071106/513c51d6/attachment.html


More information about the Delphi mailing list