ADOQuery1中切换表小问题
ADOQuery1控键中SQL为 select * from Prg_Info
想实现在程序中按Button1 将ADOQuery1里SQL的表替换为TS_Info对其中数据进行操作,请问各位高手怎么实现?
[解决办法]
如果是SQLServer,执行select * from TS_Info即可
ADOQuery-> Close() ;
ADOQUery-> SQL-> Text = "SELECT * FROM Table1 " ;
ADOQUery-> Open() ;
ADOQuery-> Close() ;
ADOQUery-> SQL-> Text = "SELECT * FROM Table2 " ;
ADOQUery-> Open() ;
[解决办法]
Button1 的OnClick里写
ADOQuery1-> Close();
ADOQuery1-> SQL-> Clear();
ADOQuery1-> SQL-> Add( "select * from TS_Info ");
ADOQuery1-> Open();
即可