H
hurryman
Unregistered / Unconfirmed
GUEST, unregistred user!
一個問題讓我痛苦一下午!
在我作報表時遇到的問題:
我用ADOdataset与QuickRep連接,
當我的ADOdataset.Commandtext為時:
select pcps.dept, pdate,pcode, pcps.type, cont, pcps.rmb,pcps.hkd,rece,rmk,
sum(rmb1) as a ,sum(rmb2) as b ,sum(rmb3) as c,sum(hkd1) as d ,sum(hkd2) as e ,sum(hkd3) as f
,sum(psal.rmb) as g ,sum(psal.hkd) as h
from pcps ,psal ,dept
where pcps.dept=psal.dept and pcps.pdate between '01/01/2002' and '01/30/2002'
~~~~~~~~~~~~~ ~~~~~~~~~~~~
and pcps.dept between 'db01' and 'db50' and pcps.dept=dept.dept
~~~~~ ~~~~~~~
group by pcps. dept,pdate,pcode,pcps.type,cont,pcps.rmb,pcps.hkd,rece,rmk
右擊QuickRep預覽是對的(測試)
而當我的ADOdataset.Commandtext為時:
select pcps.dept, pdate,pcode,pcps.type,cont,pcps.rmb,pcps.hkd,rece,rmk,
sum(rmb1) as a ,sum(rmb2) as b ,sum(rmb3) as c,sum(hkd1) as d ,sum(hkd2) as e ,sum(hkd3) as f
,sum(psal.rmb) as g ,sum(psal.hkd) as h
from pcps ,psal ,dept
where pcps.dept=psal.dept and pcps.pdate between :fdate and :edate
~~~~~~~ ~~~~~~
and pcps.dept between :fdept and :edept and pcps.dept=dept.dept
~~~~~~~ ~~~~~~
group by pcps. dept,pdate,pcode,pcps.type,cont,pcps.rmb,pcps.hkd,rece,rmk
order by pcps.dept ,pdate
******************************************************
begin
application.CreateForm(tform12,form12);
form12.QRLabel5.Caption :=datetostr(tempdate1);
form12.QRLabel6.Caption :=datetostr(tempdate2);
with form12.ADODataSet1 do
begin
active :=false;
Parameters.ParamByName('fdate').Value :=tempdate1;
parameters.ParamByName('edate').Value :=tempdate2;
parameters.ParamByName('fdept').Value :=tempdept1;
parameters.ParamByName('edept').Value :=tempdept2;
active :=true;
end;
form12.QuickRep1.Preview ;
form12.close;
end;
******************************
報表里沒有數据,這到底升錯在哪里?
在我作報表時遇到的問題:
我用ADOdataset与QuickRep連接,
當我的ADOdataset.Commandtext為時:
select pcps.dept, pdate,pcode, pcps.type, cont, pcps.rmb,pcps.hkd,rece,rmk,
sum(rmb1) as a ,sum(rmb2) as b ,sum(rmb3) as c,sum(hkd1) as d ,sum(hkd2) as e ,sum(hkd3) as f
,sum(psal.rmb) as g ,sum(psal.hkd) as h
from pcps ,psal ,dept
where pcps.dept=psal.dept and pcps.pdate between '01/01/2002' and '01/30/2002'
~~~~~~~~~~~~~ ~~~~~~~~~~~~
and pcps.dept between 'db01' and 'db50' and pcps.dept=dept.dept
~~~~~ ~~~~~~~
group by pcps. dept,pdate,pcode,pcps.type,cont,pcps.rmb,pcps.hkd,rece,rmk
右擊QuickRep預覽是對的(測試)
而當我的ADOdataset.Commandtext為時:
select pcps.dept, pdate,pcode,pcps.type,cont,pcps.rmb,pcps.hkd,rece,rmk,
sum(rmb1) as a ,sum(rmb2) as b ,sum(rmb3) as c,sum(hkd1) as d ,sum(hkd2) as e ,sum(hkd3) as f
,sum(psal.rmb) as g ,sum(psal.hkd) as h
from pcps ,psal ,dept
where pcps.dept=psal.dept and pcps.pdate between :fdate and :edate
~~~~~~~ ~~~~~~
and pcps.dept between :fdept and :edept and pcps.dept=dept.dept
~~~~~~~ ~~~~~~
group by pcps. dept,pdate,pcode,pcps.type,cont,pcps.rmb,pcps.hkd,rece,rmk
order by pcps.dept ,pdate
******************************************************
begin
application.CreateForm(tform12,form12);
form12.QRLabel5.Caption :=datetostr(tempdate1);
form12.QRLabel6.Caption :=datetostr(tempdate2);
with form12.ADODataSet1 do
begin
active :=false;
Parameters.ParamByName('fdate').Value :=tempdate1;
parameters.ParamByName('edate').Value :=tempdate2;
parameters.ParamByName('fdept').Value :=tempdept1;
parameters.ParamByName('edept').Value :=tempdept2;
active :=true;
end;
form12.QuickRep1.Preview ;
form12.close;
end;
******************************
報表里沒有數据,這到底升錯在哪里?