HOW IndexFieldNames descending in TIBconn? lazarus / 16-Databases ---------------------------------------------------------------------- Fortuna1 · 2012-05-21 04:44 SQLQuery1.IndexFieldNames:='ind1 desc'; ---------------------------------------------------------------------- Lacak2 · 2012-05-21 05:38 You must use procedure AddIndex. AFAIK there is no way how set ixDescending by setting IndexFieldNames. ---------------------------------------------------------------------- Fortuna1 · 2012-05-21 11:31 ok thanks ---------------------------------------------------------------------- Fortuna1 · 2012-05-21 18:55 SQLQuery1.IndexDefs.Add('KEYKEY','KEYKEY',[ixDescending]);  SQLQuery1.Close;  SQLQuery1.SQL.Text := 'select * from la_prevzemD     ';  SQLQuery1.IndexName:='KEYKEY'; SQLQuery1.Open; SQLQuery1.IndexName:='KEYKEY';  This not Ok. How is correct? ---------------------------------------------------------------------- ludob · 2012-05-21 19:19 Code: [Select]  SQLQuery1.Close;   SQLQuery1.SQL.Text := 'select * from la_prevzemD     ';   SQLQuery1.AddIndex('KEYKEY','IDTABLE1,[ixDescending]);   SQLQuery1.IndexName:='IDTABLE1;   SQLQuery1.Open; You can set Indexname before or after Open. You can also do AddIndex after Open but then you need to increase the MaxIndexesCount to reserve some space in the record for the additional indices. Once the dataset is opened you can't add additional space for indices. Code: [Select]  SQLQuery1.Close;   SQLQuery1.SQL.Text := 'select * from la_prevzemD     ';   SQLQuery1.MaxIndexesCount:=4;   SQLQuery1.Open;   SQLQuery1.AddIndex('KEYKEY','IDTABLE1,[ixDescending]);   SQLQuery1.IndexName:='IDTABLE1; ---------------------------------------------------------------------- Fortuna1 · 2012-05-21 20:05 SQLQuery1.Close;    SQLQuery1.SQL.Text := 'select KEYKEY from la_prevzemD     ';    SQLQuery1.MaxIndexesCount:=4;    SQLQuery1.Open;    SQLQuery1.AddIndex('KEYKEY','KEYKEY',[ixDescending]);    SQLQuery1.IndexName:='KEYKEY'; This sort only Ascending;  SQLQuery1.Close;    SQLQuery1.SQL.Text := 'select KEYKEY from la_prevzemD     ';    SQLQuery1.MaxIndexesCount:=4;       SQLQuery1.AddIndex('KEYKEY','KEYKEY',[ixDescending]);    SQLQuery1.IndexName:='KEYKEY';    SQLQuery1.Open; This sort only Ascending; Not OK ---------------------------------------------------------------------- ludob · 2012-05-21 20:09 What version of fpc are you using? There where quite some bug fixes regarding indices recently. I'm using 2.7.1. ---------------------------------------------------------------------- Fortuna1 · 2012-05-21 20:14 fpc-2.4.2-0.i686.rpm ---------------------------------------------------------------------- marcov · 2012-05-21 20:29 Note that is a release from 2010, and there have been two releases since. ---------------------------------------------------------------------- Fortuna1 · 2012-05-21 20:49 fpc 2.6.0 not ok Where found  for linux Fendora   Fpc 2.7.1. ---------------------------------------------------------------------- Lacak2 · 2012-05-22 05:24 Can you try: Code: [Select]SQLQuery1.AddIndex('KEYKEY','IND1',[],'IND1'); 4th parameter are descending fields Code: [Select]    procedure AddIndex(const AName, AFields : string; AOptions : TIndexOptions; const ADescFields: string = '';       const ACaseInsFields: string = ''); ---------------------------------------------------------------------- marcov · 2012-05-22 07:15 Quote from: Fortuna1 on May 21, 2012, 10:49:40 pmfpc 2.6.0 not ok There are atm no known problems with 2.6.0 that didn't happen in earlier versions (dos and other fringe OSes excluded btw) QuoteWhere found  for linux Fendora   Fpc 2.7.1. Odd numbers add the end indicate development versions, not releases.