//只要前五条记录
procedure TForm1.Button1Click(Sender: TObject);
begin
  with ADODataSet1 do begin
    Close;
    CommandText := 'SELECT TOP 5 * FROM country';
    Open;
  end;
end; //去除重复
procedure TForm1.Button2Click(Sender: TObject);
begin
  with ADODataSet1 do begin
    Close;
    CommandText := 'SELECT DISTINCTROW * FROM country';
    Open;
  end;
end; //获取字段列表
procedure TForm1.Button3Click(Sender: TObject);
var
  i: Integer;
  str: string;
begin
  str := '';
  for i := to ADODataSet1.FieldDefs.Count - do
  begin
    str := str + ADODataSet1.FieldDefs[i].Name + sLineBreak;
  end;
  ShowMessage(str);
end;
05-11 20:04
查看更多