我之前做的程序的一个例子修改了一下var i:integer;begin with tdqry2 do tdqry2.Close; tdqry2.SQL.Clear; tdqry2.SQL.Add('select top 50 from bmtb order by tb001'); tdqry2.Open; if Not tdqry2.Eof then bafm.stringgrid1.RowCount:=tdqry2.RecordCount+1; //使stringgrid1的行数等于查询出的记录数 for i:=1 to tdqry2.RecordCount do Begin With bafm.Stringgrid1 Do Begin cells[0,i]:=tdqry2.FieldValues['Tb001']; cells[1,i]:=tdqry2.FieldValues['Tb002']; cells[2,i]:=tdqry2.FieldValues['Tb004']; End; tdqry2.Next; End;