StringGrid:=TStringGrid.Create(Application);
StringGrid.Col:=1;
StringGrid.RowCount:=1;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select top x * from table');
ADOQuery1.Open;
if ADOQuery1.RecordCount<>0 then
begin
While ADOQuery1.Eof=false do
begin
StringGrid.Cells[0,StringGrid.RowCount]:=ADOQuery1.fieldbyname('字段名').AsString;
StringGrid.RowCount:=StringGrid.RowCount+1;
ADOQuery1.Next;
end;
end;
ADOQuery1.colse;