简单的代码问题
求dbgird一列之和的带吗,但他不能计算,运行后出问题,有无改进的方法
procedure tform1.button1click(send:tobject)
var
sum1:real;
s:string;
bookmark1:tbookmark;
begin
sum1:=0.00;
bookmark1:=table1.getbookmark;
table1.disablecontrols;
table1.first;
while not table1.eof do
begin
sum1:=sum1+table1.fieldbyname('mingzi').value;
table1.next;
end;
table1.gotobookmark(bookmark1);
table1.freebookmark(bookmark1);
table1.enablecontrols;
str(sum1:8:2,s);
editdbedit1.text:=s;
end;