本文整理自网络,侵删。
//只要前五条记录
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 := 0 to ADODataSet1.FieldDefs.Count - 1 do
begin
str := str + ADODataSet1.FieldDefs[i].Name + sLineBreak;
end;
ShowMessage(str);
end;
相关阅读 >>
Delphi 每年、月、周、日的开始与结束的时间startofayear … startoftheyear … endofayear … endoftheyear
更多相关阅读请进入《Delphi》频道 >>