在三层中,要查询出符合条件的数量合计与金额合计报错。 没人会吗,再加30分,回答出来去http://www.delphibbs.com/delphibbs/di

  • 主题发起人 主题发起人 fly555
  • 开始时间 开始时间
F

fly555

Unregistered / Unconfirmed
GUEST, unregistred user!
在三层中,要查询出符合条件的数量合计与金额合计报错。 没人会吗,再加30分,回答出来去http://www.delphibbs.com/delphibbs/dispq.asp?lid=1972341领30分 (20分)<br />在三层中,想要查询出符合条件的数量合计与金额合计
s3:='select sl=sum(quantity1),je=sum(money1) from xsdview where xsdid<> '+''' ''';
if combobox1.Text <>''
then
s1:=s1+' and username='+''''+combobox1.Text +'''';
s1:=s1+' and rq>='+''''+datetostr(dp1.Date) +'''';
s1:=s1+' and rq<='+''''+datetostr(dp2.Date) +'''';
if edit3.Text <>''
then
s1:=s1+' and xsdid >='+''+edit3.Text +'';
if edit4.Text <>''
then
s1:=s1+' and xsdid <='+''+edit4.Text +'';
if edit5.Text <>''
then
s1:=s1+' and khid='+''''+edit5.Text +'''';
if edit6.Text <>''
then
s1:=s1+' and ywyid='+''''+edit6.Text +'''';
if edit7.Text <>''
then
s1:=s1+' and chid='+''''+edit7.Text +'''';
if edit8.Text <>''
then
s1:=s1+' and quantity1>='+''+edit8.Text +'';
if edit9.Text <>''
then
s1:=s1+' and quantity1<='+''+edit9.Text +'';
if edit10.Text <>''
then
s1:=s1+' and money1>='+''+edit10.Text +'';
if edit11.Text <>''
then
s1:=s1+' and money1<='+''+edit11.Text +'';
if checkbox1.Checked =true
then
s1:=s1+' and ischeck=' +'''1''';
if checkbox2.Checked =true
then
s1:=s1+' and ischeck=' +'''0''';
s3:=s3+s1;
with dm.ClientDataSetxsdview2 do
begin
commandtext:='';
commandtext:=s3;
open;
end;

dm.ClientDataSetxsdview2 连接到应用程序服务器上的一个datasetprovider->一个查询
执行到倒数二行open时,
报错:参数sl没有默认值。怎么办?
 
add
------------------
dm.ClientDataSetxsdview2.close
 
不行,还是那样报错
 
设置datasetprovider的options的poallowcommandtext:=true
 
还是报错。(我本来就是这样写的)
在c/s中, 写select sl=... 是不会报错的,但在三层中
s3:='select sl=sum(quantity1),je=sum(money1) from xsdview where xsdid<> '+''' ''';
就说sl无默认值。
 
s3:='select sum(quantity1) as sl,sum(money1) as je from xsdview where xsdid<> '+''' '''
 
接受答案了.
 
后退
顶部