在StringGird的单元中读取表table的一个字段。好象不行,请问有什么办法呀。

解决方案 »

  1.   

    StringGrid不是数据敏感构件,不能构直接连table.
    可以自己写一个函数.
    思想:
    用一个双重循环.
    for i:=0 to table.recordcount-1 do
      for j:=0 to table.fields.count-1 do
    begin
        stringgrid.cells[j,i]:=table.fields[j].asstring;
        next;
    end;
      

  2.   

    for i:=0 to table.recordcount-1 do
      for j:=0 to table.fields.count-1 do
    begin
        stringgrid.cells[j,i]:=table.fields[j].asstring;
     
    end;
       next;
    end;
      

  3.   

    for i:=0 to table.recordcount-1 do
    begin
      for j:=0 to table.fields.count-1 do
        stringgrid.cells[j,i]:=table.fields[j].asstring;
      next;
    end;才对