试试select part,inDate,Price from Parts union all select '合计',Now,sum(price) from parts
select part,cast(inDate as varchar(20) Date ,Price from Parts union all select '合计','',sum(price) from parts
不行啊.. 还是出现一样的提示.. SQL.add('select part,inDate,Price from Parts union all select ''合计'',''Now'',sum(price) from parts ');
你把inDate换一个名试一下 它可能是关键字
提示信息:EdatabaseError with message' q0:type mismatch for field '日期' ,expecting:Datetime actual:WideString'
SQL.add('select part,inDate,Price from Parts union all select ''合计'',''Now'',sum(price) from parts ');Now()是Access中取当前时间的函数, SQL.add('select part,inDate,Price from Parts union all select ''合计'',Now(),sum(price) from parts ');
union all
select '合计',Now,sum(price) from parts
union all
select '合计','',sum(price) from parts
还是出现一样的提示..
SQL.add('select part,inDate,Price from Parts union all select ''合计'',''Now'',sum(price) from parts ');
它可能是关键字
q0:type mismatch for field '日期' ,expecting:Datetime actual:WideString'
SQL.add('select part,inDate,Price from Parts union all select ''合计'',Now(),sum(price) from parts ');
回楼上..确定是这样的问题..但我的报表里不需要,在底部打一个now(),如果不用now还有没别的办法?
union all
select '合计','',sum(price) from parts
union all
select '合计','',sum(price) from parts