Q&A

  • 크아 왜 db그리드에는 잘 나오는데 다른데는 안나오죠?
훔..미치겠습니다.

query1.Close;

query1.SQL.Clear;

query1.SQL.Add('use boarddb');

query1.ExecSQL;

query1.SQL.Clear;

query1.SQL.Add('select title,comment from siwhang_tbl where qna="" order by no desc limit 0,20');

query1.Open;



for i := 1 to query1.RecordCount do begin

stringgrid1.Cells[0,i] := query1.Fields[0].asstring;

query1.Next;

end;

보시면 위처럼 했을때 분명 db그리드에는 잘 나옵니다

그런데 왜 recordcount 는 -1 로 나오죠?

포문에 아예 접근을 못하네요.ㅡㅡ 뭐를 잘못한걸까요..

크아...

2  COMMENTS
  • Profile
    김병식 2001.12.06 21:55
    ==>

    I := 1;

    > while not query1.Eof do

    begin

    stringgrid1.Cells[0,i] := query1.Fields[0].asstring;

    Inc(I);

    > query1.Next;

    > end;





    열심히 wrote:

    > 훔..미치겠습니다.

    > query1.Close;

    > query1.SQL.Clear;

    > query1.SQL.Add('use boarddb');

    > query1.ExecSQL;

    > query1.SQL.Clear;

    > query1.SQL.Add('select title,comment from siwhang_tbl where qna="" order by no desc limit 0,20');

    > query1.Open;

    >

    > for i := 1 to query1.RecordCount do begin

    > stringgrid1.Cells[0,i] := query1.Fields[0].asstring;

    > query1.Next;

    > end;

    > 보시면 위처럼 했을때 분명 db그리드에는 잘 나옵니다

    > 그런데 왜 recordcount 는 -1 로 나오죠?

    > 포문에 아예 접근을 못하네요.ㅡㅡ 뭐를 잘못한걸까요..

    > 크아...

  • Profile
    구창민 2001.12.06 09:31
    Indicates the total number of records associated with the dataset.



    property RecordCount: Longint;



    Description



    Examine RecordCount to determine the total number of records in the dataset. Applications might use this property with RecNo to iterate through all the records in a dataset, though typically record iteration is handled with calls to First, Last, MoveBy, and Prior.



    Note: Use RecordCount with care, because record counting can be a costly operation, especially for SQL queries that return large result sets. Generally, an application should only use RecordCount with Paradox and dBASE tables.







    열심히 wrote:

    > 훔..미치겠습니다.

    > query1.Close;

    > query1.SQL.Clear;

    > query1.SQL.Add('use boarddb');

    > query1.ExecSQL;

    > query1.SQL.Clear;

    > query1.SQL.Add('select title,comment from siwhang_tbl where qna="" order by no desc limit 0,20');

    > query1.Open;

    >

    > for i := 1 to query1.RecordCount do begin

    > stringgrid1.Cells[0,i] := query1.Fields[0].asstring;

    > query1.Next;

    > end;

    > 보시면 위처럼 했을때 분명 db그리드에는 잘 나옵니다

    > 그런데 왜 recordcount 는 -1 로 나오죠?

    > 포문에 아예 접근을 못하네요.ㅡㅡ 뭐를 잘못한걸까요..

    > 크아...