Q&A

  • ado 쓰는데 속도가 너무 느립니다..ㅠ.ㅠ
델파이 6
MSSQL 2000
ADO

<!--CodeS-->
For i := 1 To grdF02.RowCount Do grdF02.Delete(1);
    if edtF06.Text <> '' then begin
       with qrD,grdF02 do begin   // 현 재고량
          Close;
          Sql.Clear;
          Sql.Text := 'Select A.PartNo, A.Gdcode, A.Gdcode1, Sum(A.Ipgo+A.EIpgo-A.Chgo-A.EChgo+A.Ctrl) Jaego ' +
                      '  from  GStock A ' +
                      ' Where A.YYYYMM >= ''' + Copy(edtF01.Text,1,4) + '00''' +
                      '  and A.YYYYMM <= ''' + Copy(edtF01.Text,1,6) + '''' +
                      '  and A.Gdcode  = ''' + edtF06.Text + '''' +
                      ' Group by A.PartNo, A.Gdcode, A.Gdcode1 ' +
                      ' Order by A.Gdcode, A.Gdcode1 ';
          Open;
          RowCount := RecordCount+2;
          i:=1;
          first;
          BeginUpdate;
          while Not EOF do begin
             Cells[0,i] := Fieldbyname('Gdcode1').AsString;
             Cells[1,i] := vfgDtoC(Fieldbyname('Jaego').AsFloat,0,0);
             with qrSu do begin    // 총 주문량
                Close;
                Sql.Clear;
                Sql.Text := ' Select Sum(M.Jurang) Jurang, Sum(M.Chgorang) Chgorang, Sum(M.Jaegong) Jaegong ' +
                            '   From ( ' +
                            '         Select Sum(A.Surang) Jurang, 0 Chgorang, 0 Jaegong ' +
                            '           from  SujuT A, PartNo B ' +
                            '          Where A.PartNo = B.PartNo' +
                            '            and A.CusCode = B.CusCode' +
                            '            and A.SeqNo = B.SeqNo' +
                            '            and A.Sujuil >= ''' + HME_Minus_YYMM(Copy(edtF01.Text,1,6),3) +'01''' +
                            '            and A.Sujuil <= ''' + Copy(edtF01.Text,1,6) +'31''' +
                            '            and B.GdCode = ''' + edtF06.Text + '''' +
                            '            and B.GdCode1= ''' + qrD.Fieldbyname('Gdcode1').AsString + ''''  +
                            '         Union  ' +
                            '         Select 0 Jurang, Sum(A.Surang) Chgorang, 0 Jaegong ' +
                            '           from  GChgoT A, PartNo B ' +
                            '          Where A.PartNo = B.PartNo ' +
                            '            and A.CusCode = B.CusCode ' +
                            '            and A.SeqNo = B.SeqNo' +
                            '            and A.Junpil >= ''' + HME_Minus_YYMM(Copy(edtF01.Text,1,6),3) +'01''' +
                            '            and A.Junpil <= ''' + Copy(edtF01.Text,1,6) +'31''' +
                            '            and B.GdCode = ''' + edtF06.Text + '''' +
                            '            and B.GdCode1= ''' + qrD.Fieldbyname('Gdcode1').AsString + '''' +
                            '         Union  ' +
                            '         Select 0 Jurang, 0 Chgorang, Sum(A.InGeyRang) Jaegong' +
                            '           from  GjCtrl A, SaejiH B' +
                            '          Where A.SaejiNo = B.SaejiNo' +
                            '            and B.GdCode = ''' + edtF06.Text + '''' +
                            '            and A.Insurang - A.InGeyRang - A.JanRang - A.PegiRang - A.CtrlRang > 0 ' +
                            '        ) M ';
                Open;
             end;
             Cells[2,i] := vfgDtoC(qrSu.Fieldbyname('Jurang').AsFloat/3,0,0);
             Cells[3,i] := vfgDtoC(qrSu.Fieldbyname('Chgorang').AsFloat/3,0,0);
             Cells[4,i] := vfgDtoC(qrSu.Fieldbyname('Jaegong').AsFloat,0,0);
             INC(I);
             Next;
          end;
          EndUpDate;
       end;
    end;
<!--CodeE-->


위가 전체 소스 입니다..
그리드에 뿌려주는 루틴인데.. 속도가 너무 느려요..
빠르게 뿌려주는 방법 없을까요?

쿼리 한개는 빠른데.. 쿼리 안에 쿼리가 있으면 속도가 많이 느리네요.
BDE 는 빨랐는데.. ADO 는 느리네요.. 더 빠를꺼라는 글을 보고 쓰고 있는데.. 쩝..
위에 소스로 DBE에서 돌리면 1초면 나오는데.. ADO 5초 이상 걸리네요..
데이터 10줄 미만으로 뿌려 주는데..
방법 없을까요??
0  COMMENTS