with aq3 do
begin
close;
sql.Clear;
sql.Add('select studentno,studentname into #temp from student where classno=:p1');
parameters.ParamByName('p1').Value:='2001';
aq3.ExecSQL;
showmessage(aq3.SQL.Text);
close;
sql.Clear;
sql.Add('select * from #temp');
open;
end;
----------------------------------------------------------
以上是代码;当我没有where字句的时候是可以的.
但是有where字句的时候不能生成局部临时表,能生成全局临时表和不带#的表.
真是弄不懂borand了..到底是什么问题啊
begin
close;
sql.Clear;
sql.Add('select studentno,studentname into #temp from student where classno=:p1');
parameters.ParamByName('p1').Value:='2001';
aq3.ExecSQL;
showmessage(aq3.SQL.Text);
close;
sql.Clear;
sql.Add('select * from #temp');
open;
end;
----------------------------------------------------------
以上是代码;当我没有where字句的时候是可以的.
但是有where字句的时候不能生成局部临时表,能生成全局临时表和不带#的表.
真是弄不懂borand了..到底是什么问题啊
但是如果是#temp而且没有where 子句也可以..
这种莫明奇妙的问题产生了..晕啊..
各位帮我看看啊.
var p1:string;.......with aq3 do
begin
p1:=inttostr('2001')
close;
sql.Clear;
sql.Add('select studentno,studentname into #temp'+
' from student'+
' where classno='''+p1+''''); // p1为string类型;
aq3.ExecSQL;
showmessage(aq3.SQL.Text);
close;
sql.Clear;
sql.Add('select * from #temp');
open;
end;
好像还是有问题啊.
无法建立#temp.........
关键是不行啊.我创建后说无法找到临时表#temp
报错是在select 语句里面出现.
我估计是原先的那个生成#temp的语句没有起作用啊.
我都调试了很久了.
Parameters.Clear;
Parameters.AddParameter.Name := 'p1'; //要加参数名定義
parameters.ParamByName('p1').Value:='2001';
不行.还是一样的啊.
还是无法创建表#temp
有没有出现过这种问题啊