Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-10

Question with 2 different querys with Firebird

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Eduardo Lopez

Hello all:

I'm working with an application that must do 2 querys I can connect with the Firebird DB, do the first query and all is ok.

   Query := TIBQuery.Create(nil);
   Query.Database := Database;
   Query.Transaction := Trans;
   Trans.Action := caCommitRetaining;
   Trans.Active := True;
   Query.SQL.Text := 'Select field1, field2, field3 from table1';
   Query.Open;
   While Not Query.Eof do
         ...
       Query.Next;
   end;
   Query.Close;
   Trans.Commit;
   Query.Sql.Text := '';

(all fine ...)

If I do a _second_ query to the same table, with the _same_ or _less_ fields it's ok.
But I can't do a query with others fields of the table:

Query.SQL.Text := 'Select field4, field5, from table1';
doesn't work, just tell me that can't find these fields.

The same things occurs if as _second_ query I try to do a search in another table, like:

Query.SQL.Text := 'Select field_a, field_b, from table2';

The question is:

What I am missing (or ignoring) to reset the query? Actually to solve my problem I'm creating another query (Query2 :=TIBQuery.Create(nil)) and using it, but I must create a query for each diferent access to the DB?

Thanks in advance. Eduardo.

Reply by email