0
hello我是zeos數據集的新手,我希望我的db網格能夠以升序或降序模式對數據進行排序。我正在使用zeos數據集和一個firebird數據庫。我試圖尋找,這就是我的一切如何在delphi 7中對dbgrid上的數據進行排序
procedure TForm1.DBGrid1TitleClick(Column: TColumn);
{$J+}
const PreviousColumnIndex : integer = -1;
{$J-}
begin
if DBGrid1.DataSource.DataSet is TCustomADODataSet then
with TCustomADODataSet(DBGrid1.DataSource.DataSet) do
begin
try
DBGrid1.Columns[PreviousColumnIndex].title.Font.Style :=
DBGrid1.Columns[PreviousColumnIndex].title.Font.Style - [fsBold];
except
end;
Column.title.Font.Style :=
Column.title.Font.Style + [fsBold];
PreviousColumnIndex := Column.Index;
if (Pos(Column.Field.FieldName, Sort) = 1)
and (Pos(' DESC', Sort)= 0) then
Sort := Column.Field.FieldName + ' DESC'
else
Sort := Column.Field.FieldName + ' ASC';
end;
end;
,這是從其他網站,但問題是我無法弄清楚如何使用它的ZEOS數據集。這是迄今爲止我得到了什麼
procedure Tdc.DBGrid1TitleClick(Column: TColumn);
begin
with TZtable (DBGrid1.DataSource.DataSet) do
Sort := Column.Field.FieldName; + ' ASC'
end;
但坦白說,我不知道從哪裏開始
不知道您的特定數據集,但使用'TADOQuery'我總是修改SQL語句的'order by'子句並刷新它。 – 2013-04-07 16:13:14
我不熟悉ZEOS mybe這將有助於http://www.lazarusforum.de/viewtopic.php?f=17&t=5884,另一個嘗試將查詢數據與「order by」 – bummi 2013-04-07 16:35:49
@bummi謝謝你將嘗試你給我的鏈接 – 2013-04-07 16:42:35