G
gaoliang80
Unregistered / Unconfirmed
GUEST, unregistred user!
private
{ Private declarations }
function getfieldname:string;
function getsortway:string;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ADODataSet1AfterOpen(DataSet: TDataSet);
var
icount:integer;
begin
for icount:=0 to adodataset1.fields.count-1 do
begin
rgfieldnames.items.add(adodataset1.Fields[icount].fieldname);
end;
rgfieldnames.ItemIndex:=0;
end;
function tform1.getfieldname:string;
begin
result:=adodataset1.fields[rgfieldnames.itemindex].fieldname;
end;
function tform1.getsortway:string;
begin
result:='ASC';
if rbtndesc.checked then
result:='DESC';
end;
procedure Tform1.Button1Click(sender:tobject);
begin
adodataset1.Sort:=getfieldname+getsortway;
end;
end.
报错:项目在所需的名称或序数中未被发现
{ Private declarations }
function getfieldname:string;
function getsortway:string;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ADODataSet1AfterOpen(DataSet: TDataSet);
var
icount:integer;
begin
for icount:=0 to adodataset1.fields.count-1 do
begin
rgfieldnames.items.add(adodataset1.Fields[icount].fieldname);
end;
rgfieldnames.ItemIndex:=0;
end;
function tform1.getfieldname:string;
begin
result:=adodataset1.fields[rgfieldnames.itemindex].fieldname;
end;
function tform1.getsortway:string;
begin
result:='ASC';
if rbtndesc.checked then
result:='DESC';
end;
procedure Tform1.Button1Click(sender:tobject);
begin
adodataset1.Sort:=getfieldname+getsortway;
end;
end.
报错:项目在所需的名称或序数中未被发现