怎样取sum()值

linlingwei 2004-03-14 03:34:38
procedure Tpfck_form.RzBitBtn4Click(Sender: TObject);
var total:double;
begin
adoquery1.Close ;
adoquery1.SQL.Clear ;
adoquery1.SQL.Add('select sum(total) from pfck where user_flag='+''''+form_main.StatusBar1.Panels[1].text+'''');
adoquery1.open ;
怎样把adoquery中的值赋给total?

end;
...全文
61 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ailibuli 2004-03-14
  • 打赏
  • 举报
回复
也可用别名
adoquery1.SQL.Add('select sum(total) sum_total from pfck where
...
total := adoquery1.fieldbyname('sum_total').AsVariant;
nhdj 2004-03-14
  • 打赏
  • 举报
回复
写sql用as就可以了
adoquery1.SQL.Add('select sum(total) as sumall from pfck where user_flag='+''''+form_main.StatusBar1.Panels[1].text+'''');


total:=adoquery1.FieldByName('sumall').AsInteger;
haust124 2004-03-14
  • 打赏
  • 举报
回复
这样就行了
total:=adoquery1.FieldByName('sum(total)').AsInteger;
应该没有问题的!
yitong0834 2004-03-14
  • 打赏
  • 举报
回复
total := adoquery1.fieldbyname('Expr1000').AsVariant;

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧