李
李璋琦
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一段程序,愿意是动态查询WEB数据库
function Twebmodule1.gettail(parentStr:string):string;
var
len:integer;
parentcharchar;
begin
parentchar:=pchar(parentstr);
parentchar:=strscan(parentchar,'=');
parentstr:=string(parentchar);
len:=length(parentStr);
result:=copy(parentstr,2,len-1);
end;
procedure TWebModule1.WebModule1QueryPriceAction(Sender: TObject;
Request: TWebRequest;
Response: TWebResponse;
var Handled: Boolean);
var
I:integer;
added:boolean;
select,fldqry,cndqry,valqry,flag:string;
qrydata:Tstrings;
begin
added:=false;
with requestdo
case methodtype of
mtget: qrydata:=queryfields;
mtpost: qrydata:=contentfields;
end;
//case
for i:=0 to qrydata.count-1do
begin
flag:='';
flag:=UpperCase(copy(qrydata.strings,1,3));
if flag='CHK' then
if not added then
begin
select:=select+gettail(qrydata.strings);
added:=true;
End
else
select:=select+','+gettail(qrydata.strings);
if flag='FLD' then
fldqry:= gettail(qrydata.strings);
if flag='CND' then
cndqry:= gettail(qrydata.strings);
if flag='VAL' then
valqry:= gettail(qrydata.strings);
end;
//for
with querytableproducer1do
begin
query.sql.clear;
query.sql.add('SELECT SP1 商品编号, SP2 商品名称, SP3 单位,SP4 品牌, SP5 规格, SP6 型号,SP7 产地, SP8 监测, SP9 说明 FROM "SPZK.DBF" Spzk ');
query.sql.add('where ');
query.sql.add(fldqry);
query.sql.add(' '+cndqry);
query.sql.add(' "'+valqry+'"');
query.open;
response.content:=querytableproducer1.content;
query.close;
end;
end;
可是出现了:
Exception: EDatabaseError
Message: Query1: Parameter 'FldQry' not found
错在那里?
function Twebmodule1.gettail(parentStr:string):string;
var
len:integer;
parentcharchar;
begin
parentchar:=pchar(parentstr);
parentchar:=strscan(parentchar,'=');
parentstr:=string(parentchar);
len:=length(parentStr);
result:=copy(parentstr,2,len-1);
end;
procedure TWebModule1.WebModule1QueryPriceAction(Sender: TObject;
Request: TWebRequest;
Response: TWebResponse;
var Handled: Boolean);
var
I:integer;
added:boolean;
select,fldqry,cndqry,valqry,flag:string;
qrydata:Tstrings;
begin
added:=false;
with requestdo
case methodtype of
mtget: qrydata:=queryfields;
mtpost: qrydata:=contentfields;
end;
//case
for i:=0 to qrydata.count-1do
begin
flag:='';
flag:=UpperCase(copy(qrydata.strings,1,3));
if flag='CHK' then
if not added then
begin
select:=select+gettail(qrydata.strings);
added:=true;
End
else
select:=select+','+gettail(qrydata.strings);
if flag='FLD' then
fldqry:= gettail(qrydata.strings);
if flag='CND' then
cndqry:= gettail(qrydata.strings);
if flag='VAL' then
valqry:= gettail(qrydata.strings);
end;
//for
with querytableproducer1do
begin
query.sql.clear;
query.sql.add('SELECT SP1 商品编号, SP2 商品名称, SP3 单位,SP4 品牌, SP5 规格, SP6 型号,SP7 产地, SP8 监测, SP9 说明 FROM "SPZK.DBF" Spzk ');
query.sql.add('where ');
query.sql.add(fldqry);
query.sql.add(' '+cndqry);
query.sql.add(' "'+valqry+'"');
query.open;
response.content:=querytableproducer1.content;
query.close;
end;
end;
可是出现了:
Exception: EDatabaseError
Message: Query1: Parameter 'FldQry' not found
错在那里?