
delphi统计数据问题
想点击buttom1然后edit1显示统计出表sale中的total在查询分析器中我使用了computesum(toeal)可以显示出来!但是不知怎样用edit1显示!以...
想点击buttom1然后edit1显示 统计出表sale中的total
在查询分析器中我使用了compute sum(toeal)可以显示出来!但是不知怎样用edit1显示!
以下是buttom1代码:
procedure Tquerysale.Button1Click(Sender: TObject);
begin
dm.ADSsale.Close;
dm.ADSsale.CommandText:='select sale.*,goods.g_name from sale, goods where Sale.g_id=goods.g_id and S_date between '+#39+datetostr(datetimepicker1.Date)+#39+' and '+#39+datetostr(datetimepicker2.Date)+#39+'compute sum(total)';
dm.ADSsale.Open;
if dm.ADSsale.RecordCount<0 then
application.MessageBox('没有销售记录,请确认日期!','商品销售查询',mb_ok+mb_iconerror+mb_applmodal);
end;
各位大大教教我应该怎样加啊?
使用这个方法时edit1.text := dm.ADSsale.FieldByName('这里填写合计的字段名').AsString;出错!ADSsale后面没有FieldByName啊!我的ADSsale是TADODataSet 展开
在查询分析器中我使用了compute sum(toeal)可以显示出来!但是不知怎样用edit1显示!
以下是buttom1代码:
procedure Tquerysale.Button1Click(Sender: TObject);
begin
dm.ADSsale.Close;
dm.ADSsale.CommandText:='select sale.*,goods.g_name from sale, goods where Sale.g_id=goods.g_id and S_date between '+#39+datetostr(datetimepicker1.Date)+#39+' and '+#39+datetostr(datetimepicker2.Date)+#39+'compute sum(total)';
dm.ADSsale.Open;
if dm.ADSsale.RecordCount<0 then
application.MessageBox('没有销售记录,请确认日期!','商品销售查询',mb_ok+mb_iconerror+mb_applmodal);
end;
各位大大教教我应该怎样加啊?
使用这个方法时edit1.text := dm.ADSsale.FieldByName('这里填写合计的字段名').AsString;出错!ADSsale后面没有FieldByName啊!我的ADSsale是TADODataSet 展开
2个回答
展开全部
ADOQuery1.SQL.Text := 'select sum(要合计的字段名) as 临时字段名 from 表名';
ADOQuery1.Active := True;
edit1.text := IntToStr(ADOQuery1.FieldValues['临时字段名']);
ADOQuery1.Active := True;
edit1.text := IntToStr(ADOQuery1.FieldValues['临时字段名']);

2025-02-18 广告
在Dr. O.K. Wack Chemie GmbH,我们高度重视ZESTRON的表界面分析技术。该技术通过深入研究材料表面与界面的性质,为提升产品质量与可靠性提供了有力支持。ZESTRON的表界面分析不仅涵盖了相变化、化学反应、吸附与解吸...
点击进入详情页
本回答由ZESTRON提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询