在循环中我想让程序搜索出一条记录后就往表格中加入一行,并且在Label中显示提示,可现在程序运行结果是将全部记录搜索出来后,再全部加入到表格中,然后改变Label的Caption.其中qry1是Query,sg1是StringGrid;lfind和lcount是Label
如果让程序执行代码中的showmessage(....),结果就会是找到一行就加一行,可是总要确定一相showmessage的结果,谁能帮我解决.
var
    a:integer;  //循环数
    cust_cd,consignee_cd,do_dt,inv_no,cur_cd,notes1,notes2:string;
    amt_prc,local_amt,invoice_cost,profit,dj,sl:double;
begin
    lfind.Caption:='Searching record from DataBase,Please wait...';
    findinvoice(dtp1.Date,dtp2.Date);
    with frmdata do
    begin
        if qry1.RecordCount>0 then
        begin
            sg1.RowCount:=qry1.RecordCount+1;  //确定表格sg1的行数
            for a:=0 to qry1.RecordCount-1 do     //从DOO_H循环
            begin      //一些固定项赋值
                cust_cd:=qry1.fieldbyname('CUST_CD').AsString;
                consignee_cd:=qry1.fieldbyname('CONSIGNEE_CD').AsString;
                do_dt:=qry1.fieldbyname('DO_DT').AsString;
                inv_no:=qry1.fieldbyname('INV_NO').AsString;
                cur_cd:=qry1.fieldbyname('CUR_CD').AsString;
                notes1:=qry1.fieldbyname('NOTES1').AsString;
                notes2:=qry1.fieldbyname('NOTES2').AsString;
               //此处是大量的循环计算
                 //给表格sg1填值
                sg1.Cells[0,a+1]:=CUST_CD;
                sg1.Cells[1,a+1]:=CONSIGNEE_CD;
                sg1.Cells[2,a+1]:=DO_DT;
                sg1.Cells[3,a+1]:=INV_NO;
                sg1.Cells[4,a+1]:=CUR_CD;
                sg1.Cells[5,a+1]:=floattostr(AMT_PRC);
                sg1.Cells[6,a+1]:=floattostr(Local_Amt);
                sg1.Cells[7,a+1]:=floattostr(Invoice_cost);
                sg1.Cells[8,a+1]:=floattostr(profit);
                sg1.Cells[9,a+1]:=NOTES1;
                sg1.Cells[10,a+1]:=NOTES2;
                
                lcount.Caption:=inttostr(a+1)+' searched';
                //showmessage(inttostr(a+1)+' searched');
                qry1.Next;
            end;
        end;
    end;
    lfind.Caption:='Search Over,have '+inttostr(sg1.RowCount-1)+' record!';
end;