begin sql1 := 'select isnull(a.ks_name,b.ks_name) as q,isnull(a.TotalZhichu,0) as w,isnull(b.TotalShouru,0) as e from ';
sql1 :=sql1+'(select ks_name,sum(zhichujine) as TotalZhichu from yz_qyzc where 1>0' +s1+ 'group by ks_name) a full join(select ks_name,sum(fyje) as TotalShouru from yz_qysr where 1>0 '+s1+' group by ks_name) b on a.ks_name=b.ks_name '; if RadioButton1.Checked = true then
begin
s1 := 'and fydate>= '+''''+datetostr(DateTimePicker1.Date)+'''' + 'and fydate<= '+''''+datetostr(DateTimePicker2.Date)+'''';
end;
s1这个字段执行不了,哪写的不对????
sql1 :=sql1+'(select ks_name,sum(zhichujine) as TotalZhichu from yz_qyzc where 1>0' +s1+ 'group by ks_name) a full join(select ks_name,sum(fyje) as TotalShouru from yz_qysr where 1>0 '+s1+' group by ks_name) b on a.ks_name=b.ks_name '; if RadioButton1.Checked = true then
begin
s1 := 'and fydate>= '+''''+datetostr(DateTimePicker1.Date)+'''' + 'and fydate<= '+''''+datetostr(DateTimePicker2.Date)+'''';
end;
s1这个字段执行不了,哪写的不对????
sEnd:=DateToStr(dtpEndDate.Date)+' '+TimeToStr(dtpEndTime.Time);and fydate>=:pstarttime and fydate<=:pendtime;Query.ParamByName('pstarttime').AsDateTime:=StrToDateTime(sStart);
...试用参数进行赋值。
2.写出完成的语句,带参数,再将时间变量传进去执行