活
活在陆地上的鱼
Unregistered / Unconfirmed
GUEST, unregistred user!
当我一开始时候能进行排序的操作,但是当我点了dbgird列进行排序后,就不能够进行一开始的排序。下面是我的2段代码 没分了 新手问题多,各位仁兄帮忙看看
procedure TForm1.dbgrd1TitleClick(Column: TColumn);
begin
if ClientDataSet.IndexFieldNames=Column.FieldName then
ClientDataSet.IndexFieldNames:=Column.FieldName else
ClientDataSet.IndexFieldNames:=Column.FieldName ;
end;
procedure TForm1.N4Click(Sender: TObject);
begin
ClientDataSet.Filtered := False;
with ClientDataSet do
begin
if(DBCheckBoxEh1.Checked)then
begin
ClientDataSet.Active :=False;
ClientDataSet.CommandText :='SELECT* FROM YU order by cj';
ClientDataSet.Active :=True;
end
else
begin
ClientDataSet.Active :=False;
CommandText :='SELECT* FROM YU order by xh';
ClientDataSet.Active :=True;
end;
end;
end;
procedure TForm1.dbgrd1TitleClick(Column: TColumn);
begin
if ClientDataSet.IndexFieldNames=Column.FieldName then
ClientDataSet.IndexFieldNames:=Column.FieldName else
ClientDataSet.IndexFieldNames:=Column.FieldName ;
end;
procedure TForm1.N4Click(Sender: TObject);
begin
ClientDataSet.Filtered := False;
with ClientDataSet do
begin
if(DBCheckBoxEh1.Checked)then
begin
ClientDataSet.Active :=False;
ClientDataSet.CommandText :='SELECT* FROM YU order by cj';
ClientDataSet.Active :=True;
end
else
begin
ClientDataSet.Active :=False;
CommandText :='SELECT* FROM YU order by xh';
ClientDataSet.Active :=True;
end;
end;
end;