数据库是access型的,用ADO联结,字段有name(sting型)、 sj(integer型),
库中数据假设如下
name    sj
xc      100
xc      500
dc      30
dc      100请帮忙分析一下下面的程序的问题:
z:=0;
for m:=1 to table1.recordcount do
begin
z:=z+table1sj.value;
table1.next;
end;
此段代码运行后能够得出正确的库中所有sj字段值的和(730)。z:=0;
for m:=1 to table1.recordcount do
begin
if table1name.value=edit1.text then z:=z+table1sj.value
else
table1.next;
end;
此段代码运行后却不能得出正确的结果,假设edit1.text:=xc则此段代码运行后得出结果不是600而是400(即100加4次),百思不得其解!请高手指点!