Q&A

  • for문... 값이 제대로 update가...안되염... ㅜㅜ
        sDate  := ADOQuery1TS_FDATE.AsString;
        tsDate := StrToDate(Copy(sDate,1,4) + '-' + Copy(sDate,5,2) + '-' + Copy(sDate,7,2));
                for j := 1 to ADOQuery1CNT.AsInteger do begin
                    for i := 0 to ADOQuery1.RecordCount -1 do begin
                        With ADOQuery2 do begin
                                Close;
                                SQL.Clear;
                                SQL.Add('UPDATE STATUS                                                 ');
                                SQL.Add('   SET STATUS = ''0''                                          ');
                                SQL.Add(' WHERE DATE   = ''' + FormatDateTime('yyyymmdd', tsDate) + ''' ');
                                SQL.Add('   AND NO  = ''' + ADOQuery1.FieldByName('NO').AsString + ''' ');
                                ExecSql;
                             end;
                        end;
                        ADOQuery1.NEXT;
                    end;
                    tsDate := tsDate + 1;
                end;

/////////////////////////////////////////////////////////////////////

이중for문은 언제나 헷갈린거 같아염..
고수님들의 답변 부탁드립니다. 꾸벅^^
2  COMMENTS
  • Profile
    최은석 2003.01.07 03:45
    execsql 다음에 end 가 더 들어가 있네여..

    for j := 1 to ADOQuery1CNT.AsInteger do
    begin
       ADOQuery1.first;
       while not ADOQuery1.eof do
       begin
          With ADOQuery2 do
          begin
             Close;
             SQL.Clear;
             SQL.Add('UPDATE STATUS                                                 ');
             SQL.Add('   SET STATUS = ''0''                                          ');
             SQL.Add(' WHERE DATE   = ''' + FormatDateTime('yyyymmdd', tsDate) + ''' ');
             SQL.Add('   AND NO  = ''' + ADOQuery1.FieldByName('NO').AsString + ''' ');
             ExecSql;
          end;
          ADOQuery1.NEXT;
       end;
       tsDate := tsDate + 1;
    end;



  • Profile
    귀염둥이^^ 2003.01.07 18:55
    답변주셔서 감사합니다 ^^