Temporary Table cannot be found when I open other Query befo
Posted: Fri 27 Aug 2010 11:12
I would like to use a temporary table with TMSQuery but I have a strange problem - when I open other query where records count > FetchRows and FetchAll = false before doing something with query where I get information from temporary table I have an error message that temporary table doesn't exists.
Example (Q1 - ordinary query, QTmp - query to temporary table):
Q1.FetchAll := false;
Q1.FetchRows := 25;
Q1.SQL.Text := select top 26 * from table1;
QTmp.SQL.Text := select * from #tmp_table;
QTmp.Close;
QTmp.Open;
QTmp.Append;
QTmp.fieldByName('Field1').AsString := 'it works';
QTmp.Post; // the record is added to temporary table
Q1.Close;
Q1.Open;
QTmp.Append;
QTmp.fieldByName('Field1').AsString := 'failure';
QTmp.Post; // here I've an error message table doesn't exists
when I change
Q1.SQL.Text := select top 24 * from table1;
the number of records is lower than Q1.FetchRows
or I set Q1.FetchAll := true; everything works fine.
How to solve this problem ?
I use version 4.50.0.39.
kind regards
ZS
Example (Q1 - ordinary query, QTmp - query to temporary table):
Q1.FetchAll := false;
Q1.FetchRows := 25;
Q1.SQL.Text := select top 26 * from table1;
QTmp.SQL.Text := select * from #tmp_table;
QTmp.Close;
QTmp.Open;
QTmp.Append;
QTmp.fieldByName('Field1').AsString := 'it works';
QTmp.Post; // the record is added to temporary table
Q1.Close;
Q1.Open;
QTmp.Append;
QTmp.fieldByName('Field1').AsString := 'failure';
QTmp.Post; // here I've an error message table doesn't exists
when I change
Q1.SQL.Text := select top 24 * from table1;
the number of records is lower than Q1.FetchRows
or I set Q1.FetchAll := true; everything works fine.
How to solve this problem ?
I use version 4.50.0.39.
kind regards
ZS