It does not work in ADODataSet IndexDef?

426 views Asked by At

I am creating a persistent index ADODataSet but not order information, my code is as follows:

ADODataSetInforArtic.IndexDefs.Clear;
case ComboBoxOrden.AsValue of
  0: begin
       with ADODataSetInforArtic.IndexDefs.AddIndexDef do
       begin
         Name := 'DenomArtic';
         Fields := 'DenomArtic';
         if ComboBoxOrden.Buttons.Image1.Id = 59 then
           Options := [ixDescending];
         ADODataSetInforArtic.IndexName := Name;
       end;
     end;

What am I doing wrong? I do it this way because it is a report I'm doing. No grid, what you have is a combo in which you choose the field that will be ordered information and another button that can select ascending or descending. I do not understand that is not working .... I use delphi xe2 Best regards

1

There are 1 answers

0
jmontegrosso On

Sorry for the delay, the components I use in my projects so developed by independent programmers Spanish (JfControls), greatly facilitate the development and are more aesthetically cute. I solved my problem by using the Sort property ...

ADODataSet.Sort := 'CodigDenom DESC';

I do not understand why my previous code did not work in ADODataset. The indexDefs work wonderfully in the ClientDataSet.

Also, I use for my reports ReportBuilder

Best regards.