StringGrid1.ColCount:=DataSet.FieldCount; StringGrid1.RowCount:=1; nRow:=0; DataSet.First; while not DataSet.Eof do begin for nCol:=0 to DataSet.FieldCount-1 do begin StringGrid1.Cells[nCol, nRow]:=DataSet.Fields[nCol].AsString; end; DataSet.Next; nRow:=nRow+1; StringGrid1.RowCount:=nRow; end;
能否给出源码事例 thank you !!!!!!!!!!!
StringGrid1.RowCount:=1;
nRow:=0;
DataSet.First;
while not DataSet.Eof do
begin
for nCol:=0 to DataSet.FieldCount-1 do
begin
StringGrid1.Cells[nCol, nRow]:=DataSet.Fields[nCol].AsString;
end;
DataSet.Next;
nRow:=nRow+1;
StringGrid1.RowCount:=nRow;
end;