[fpc-pascal] Question with 2 different querys with Firebird

Eduardo Lopez edulopez at hotpop.com
Fri Oct 15 15:49:37 CEST 2004


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.






More information about the fpc-pascal mailing list