代码:
qu3.Close;
qu3.SQL.Clear;
qu3.sql.Add('select ID, A1,A2,A3,A4,A5 from error1');
Qu3.open;
with qu3 do
begin
First;
while not eof do
begin
if qu3.Fieldbyname('A2701').AsCurrency<>0 then
qrlb1.Caption:='不平衡';
if qu3.Fieldbyname('A2702').AsCurrency<>0 then
qrlb2.Caption:='不平衡';
if qu3.Fieldbyname('A2703').AsCurrency<>0 then
qrlb3.Caption:='不平衡';
if qu3.Fieldbyname('A2704').AsCurrency<>0 then
qrlb4.Caption:='不平衡';
if qu3.Fieldbyname('A2705').AsCurrency<>0 then
qrlb5.Caption:='不平衡';
qu3.next;
end;
QRsh.Preview;
end;为何现在显示在表中的是两行相同的数据(数据库中应该有两条ID不同的数据),而且显示的ID为同一ID,到底循环了吗?错在哪里?
qu3.Close;
qu3.SQL.Clear;
qu3.sql.Add('select ID, A1,A2,A3,A4,A5 from error1');
Qu3.open;
with qu3 do
begin
First;
while not eof do
begin
if qu3.Fieldbyname('A2701').AsCurrency<>0 then
qrlb1.Caption:='不平衡';
if qu3.Fieldbyname('A2702').AsCurrency<>0 then
qrlb2.Caption:='不平衡';
if qu3.Fieldbyname('A2703').AsCurrency<>0 then
qrlb3.Caption:='不平衡';
if qu3.Fieldbyname('A2704').AsCurrency<>0 then
qrlb4.Caption:='不平衡';
if qu3.Fieldbyname('A2705').AsCurrency<>0 then
qrlb5.Caption:='不平衡';
qu3.next;
end;
QRsh.Preview;
end;为何现在显示在表中的是两行相同的数据(数据库中应该有两条ID不同的数据),而且显示的ID为同一ID,到底循环了吗?错在哪里?
qrlb1.Caption:='不平衡';
if qu3.Fieldbyname('A2').AsCurrency<>0 then
qrlb2.Caption:='不平衡';
if qu3.Fieldbyname('A3').AsCurrency<>0 then
qrlb3.Caption:='不平衡';
if qu3.Fieldbyname('A4').AsCurrency<>0 then
qrlb4.Caption:='不平衡';
if qu3.Fieldbyname('A5').AsCurrency<>0 then
qrlb5.Caption:='不平衡';
应该是next
不报错吗?