首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

在DELPHI中如何操作循环语句

2012-02-25 
在DELPHI中怎么操作循环语句whilenotQry_out_storage_detail.EofdobeginifJustifyQuantity(Qry_out_storag

在DELPHI中怎么操作循环语句
while   not   Qry_out_storage_detail.Eof   do

begin
      if   JustifyQuantity(   Qry_out_storage_detail.fieldbyname( 'goods_id ').AsString,Qry_out_storage_detail.fieldbyname( 'goods_quantity ').AsInteger)   then
        begin
                    if   application.MessageBox(pchar( '当前有销售数量比库存大的数据,名称[ '+Qry_out_storage_detail.fieldbyname( 'goods_name ').asstring   + '],规格[ '+Qry_out_storage_detail.fieldbyname( 'goods_specification ').asstring   + '],片序[ '+Qry_out_storage_detail.fieldbyname( 'px ').asstring   + '],库存数量为: '+inttostr(nCurrcount)+ ';是否继续填写? '), '系统提示 ',mb_yesno)=idno   then

                        begin
                                  if   nCurrcount <=0   then
                                      begin
                                  Qry_out_storage_detail.Delete;
                                    怎么样才能直接跳到最后一条(Qry_out_storage_detail.NEXT语句)    

                                      end;

                          end;
                  end;


                 

            if   Qry_goods.Active   then
                  Qry_goods.Close;
                  Qry_goods.ParamByName( 'goods_name ').AsString:=Trim(DBGD_out_storage_detail.Fields[1].AsString);
                  Qry_goods.ParamByName( 'goods_specification ').AsString:=Trim(DBGD_out_storage_detail.Fields[2].AsString)+ '% ';
                  Qry_goods.ParamByName( 'goods_place ').AsString:=Trim(DBGD_out_storage_detail.Fields[3].AsString);
                  Qry_goods.ParamByName( 'goods_subject ').AsString:=Trim(DBGD_out_storage_detail.Fields[0].AsString);
                  Qry_goods.Open;
Qry_out_storage_detail.NEXT;
END;


[解决办法]
看得累了。。。。。
才明白,你是要跳出循环。

while true do
begin

break;//跳出来了。。。。 ^_^
end;

BTW:
Qry_out_storage_detail.next下一条
Qry_out_storage_detail.last最后一条
Qry_out_storage_detail.piror上一条
Qry_out_storage_detail.first第一条

这样的操作也是可行的。只是只要一句:
Qry_out_storage_detail.last最后一条
qry_out_storage_detail.next;

[解决办法]
table.first;
for i:=0 to table.recordcount-1 do
begin
if 满足删除条件 then
table.delete;
end;

热点排行