组合动态SQL的问题(100分)(100分)

  • 主题发起人 主题发起人 liufang1
  • 开始时间 开始时间
L

liufang1

Unregistered / Unconfirmed
GUEST, unregistred user!
我试图在客户端用http://134.45.8.106/tmp/h11.exe/sc?tablename=查询_关口局数据04
相应的服务器ACTION代码:
procedure TWebModule1.WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
str1,str2:string;
begin
try
database1.open;
query2.DatabaseName:=database1.DatabaseName;
query2.SQL.Clear;
str1:=request.QueryFields.Values['tablename'];
query2.SQL.Add('select * from '+str1+' where rownum<11');
str2:=query2.SQL.CommaText;
QueryTableProducer1.Query:=query2;
with QueryTableProducer1 do
begin
caption:='<h1>dfffgdf</h1>';
query2.Active:=true;;
response.Content:=QueryTableProducer1.Content;
query2.Close;
end;
except
on E: Exception do
response.Content:= E.Message+' '+str2;
end;
handled:=true;

//with
end;
执行后浏览器提示:
Query2: Parameter 'tabalename' not found
该怎么办???
 
str1:=request.QueryFields.Values[tablename];
 
>HIGOAL
这样肯定不对,语法错误!
 

http://134.45.8.106/tmp/h11.exe/sc?tablename=查询_关口局数据04
tablename不是你传过来的参数吗
 
uery2: Parameter 'tabalename' not found
~~~~~~~~~~~~~~~~????
 
后退
顶部