ADOQuery1查询出来的时间记录为:aa(开始时间),bb(结束时间)
cc 为查出来的故障范围
while not ADOQuery1.Eof then
 begin
   if cc='制动环节' then
       if aa=0 then 
          begin
            .............................(画网络图)
            .............................
          end
         else
           begin
             .......................
             .......................
           end;
       if bb=0 then
            begin
            .............................
            .............................
             end
        else
           begin

解决方案 »

  1.   

    .......................
                 .......................
               end;
        if cc='电器' then
           if aa=0 then 
              begin
                .............................
                .............................
              end;
            else
               begin
                 .......................
                 .......................
               end;
           if bb=0 then
                begin
                .............................
                .............................
                 end
            else
               begin
                 .......................
                 .......................
               end; 
     end;
    请问这样的程序有错误吗?执行时系统不报错。但就是不按规定运行。到底是怎么回事?是不是我的语法上有错误?
      

  2.   

    呵呵。。我写错了。while not ADOQuery1.Eof Do 不是then. 不好意思~!!
      

  3.   

    不会吧,while not ADOQuery1.Eof then也能通过编译?
      

  4.   

    while not ADOQuery1.Eof then
     begin
       if cc='制动环节' then
       begin //加begin
           if aa=0 then 
              begin
                .............................(画网络图)
                .............................
              end
             else
               begin
                 .......................
                 .......................
               end;
           if bb=0 then
                begin
                .............................
                .............................
                 end
            else
               begin
    .......................
                 .......................
               end;
          end;//加end
        if cc='电器' then
        begin //加begin
           if aa=0 then 
              begin
                .............................
                .............................
              end //去掉;
            else
               begin
                 .......................
                 .......................
               end;
           if bb=0 then
                begin
                .............................
                .............................
                 end
            else
               begin
                 .......................
                 .......................
               end; 
          end;//加end
     end;
      

  5.   

    if cc='制动环节' then
    begin
    if...
    if...
    end
    if cc='电器' then
    begin
    if ...
    if.. 
    end
      

  6.   

    bb的判断是独立的呢?还是属于cc的下层?
      

  7.   

    怎么没有ADOQUery.Next; //?会死循环的
      

  8.   

    aa(开始时间)=0

    bb(结束时间)
    也肯定为0所以
      

  9.   


        if cc='电器' then
           if aa=0 then 
              begin
                .............................
                .............................
              end;------------------------------------->这里多了一个“;”
            else
               begin
                 .......................
                 .......................
               end;
           if bb=0 then
                begin
      

  10.   

    哈哈,说得都有道理,这种程序可维护性太差了,应该好好改造,按照他们说得加上begin 和 end,应该就没问题了
      

  11.   

    用CASE不能解决么????奇怪