就字段的和---不用SQL语句求
procedure Tw_shfw.DataSource_GHPJUpdateData(Sender: TObject);
var
total_tmp,totalsum_tmp:integer;
begin
totalsum_tmp:=0;
total_tmp:=0;
with dm_sqlserver.ADOQuery_ghpj do
begin
first;
while not eof do
begin
total_tmp:=FieldByName('price_ghpj').Value+FieldByName('num_ghpj').Value;
totalsum_tmp:=totalsum_tmp+total_tmp;
/// showmessage(floattostr(total_tmp));
next;
end;
w_shfw.Edit_total.Text:=floattostr(totalsum_tmp);
end;
end;
上面的有点问题
在database里price_ghpj为decimal型,num_ghpj为number型