Subject | IBOQuery stubborn about remembering fields |
---|---|
Author | Hans Hoogstraat |
Post date | 2004-11-11T01:29:02Z |
Maybe this problem has been resolved in 4.5
But
with IBOQuery do
begin
close;
SQL.Clear;
SQL.Add(Select * from TableOne);
SQL.Prepare;
open;
close;
SQL.Clear;
SQL.Add(Select * from TableTwo);
SQL.Prepare;
open;
If TableTwo has different Field\Names than TableOne, I get errors on
FieldNames not found from TableOne. Tried everything to force some kind of
clear internal FieldNames.
But I did get it to work by inserting a dummy ExecSQL like. The IBOQuery is
never populated via a right click -> add all fields
with IBOQuery do
begin
close;
SQL.Clear;
SQL.Add(Select * from TableOne);
SQL.Prepare;
open;
close;
SQL.Clear
SQL.Add('Commit');
ExecSQL;
close
SQL.Clear;
SQL.Add(Select * from TableTwo);
SQL.Prepare;
open;
With the addinal ExecSQL, the internal fieldnames obtained from TableOne
seem to be cleared at the time TableTwo is queried and no error occur.
But
with IBOQuery do
begin
close;
SQL.Clear;
SQL.Add(Select * from TableOne);
SQL.Prepare;
open;
close;
SQL.Clear;
SQL.Add(Select * from TableTwo);
SQL.Prepare;
open;
If TableTwo has different Field\Names than TableOne, I get errors on
FieldNames not found from TableOne. Tried everything to force some kind of
clear internal FieldNames.
But I did get it to work by inserting a dummy ExecSQL like. The IBOQuery is
never populated via a right click -> add all fields
with IBOQuery do
begin
close;
SQL.Clear;
SQL.Add(Select * from TableOne);
SQL.Prepare;
open;
close;
SQL.Clear
SQL.Add('Commit');
ExecSQL;
close
SQL.Clear;
SQL.Add(Select * from TableTwo);
SQL.Prepare;
open;
With the addinal ExecSQL, the internal fieldnames obtained from TableOne
seem to be cleared at the time TableTwo is queried and no error occur.