ADO Database Delphi

//Seçenekler: Case Insensitive, Case Sensitive, Descending, ve Ascending.
//Bu örneğin kullandığı girdiler:
//...::::::( KORSAN )::::::...\\
SortTable(Table1, Table1.FieldByName('SortField'), False, sortDESCEND, L);
procedure SortTable(Table: TTable; Field: TField; CaseInsensitive: boolean;
Order: SORTOrder; var SortNumber: longint);
var
Props: CURProps;
FieldNumber: word;
hDb: hDBIDb;
begin
if Table.Active = False then
raise EDatabaseError.Create('Table açık olmalıdır.');
Check(DbiGetCursorProps(Table.Handle, Props));
if Props.bIndexed = True then
raise EDatabaseError.Create('Table sıralanırken index aktif olamaz');
FieldNumber := Field.Index + 1;
Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE, hDBIObj(hDb)));
Table.Close;
try
Check(DbiSortTable(hDb, PChar(Table.TableName), Props.szTableType,
nil, nil, nil, nil, 1, @FieldNumber, @CaseInsensitive, @Order, nil,
False, nil, SortNumber));
finally
Table.Open;
end;
end;