[Error] Unit1.pas(36): Undeclared identifier: 'TstringGrid1'
//'TstringGrid1'没有定义(你name写错了)
[Error] Unit1.pas(36): Missing operator or semicolon
//类型匹配不对
[Error] Unit1.pas(36): Undeclared identifier: 'count'
//count没有定义
[Error] Unit1.pas(37): Missing operator or semicolon
//类型匹配不对
[Error] Unit1.pas(38): Undeclared identifier: 'j'
//j没有定义
[Error] Unit1.pas(41): Undeclared identifier: 'i'
//i没有定义
[Error] Unit1.pas(41): 'DO' expected but identifier 'ColCount' found
[Error] Unit1.pas(43): Missing operator or semicolon
[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas'    while not ADoQuery1 .eof do
    begin
      for i := 0 to TstringGrid1.ColCount-1 do
      begin
        TstringGrid1.Cells[i,j] :=ADoQuery1 .Fields[i].asstring;
      inc(J);
      ADoQuery1.next;
      end;
    end;
  end;
/*********************************/
/*1、在CSDN上坚决反对灌水倒分    */
/*2、在看球赛时坚决支持中国队对手*/
/*4、在国际纠纷上坚决支持中国    */
/*********************************/

解决方案 »

  1.   

    //TStringGrid1 - > StringGrid1procedure TForm1.StringGrid1Click(Sender: TObject);
    var
      I, J: Integer;
    begin
      with ADoQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('Select * from nan_one');
        Open;
        StringGrid1.RowCount := ADoQuery1.RecordCount;
        StringGrid1.ColCount := ADoQuery1.Fields.Count;
        J := 0;
        while not Eof do begin
          for I := 0 to StringGrid1.ColCount - 1 do
            StringGrid1.Cells[I, J] := Fields[I].AsString;
          Inc(J);
          ADoQuery1.Next;
        end;
      end;
    end;