🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #3670

Re: Sorting DBGrid

#3670
From: Ola Eriksen
Date: Thu, 04 Jul 2002 13:35
53 lines
2296 bytes
Hi!  Thanks!

I'm trying to change the index of the table with this code:

//find the correct field
for (int I = 0; I < CustomerIp->IndexDefs->Count; I++)
{
     if (CustomerIp->IndexDefs->Items[I]->Fields == String("CustomerName"))
     {
         // set that index as the current index for the table
         CustomerIp->IndexName = CustomerIp->IndexDefs->Items[I]->Name;
       }
}


the problem is that IndexDefs->Count returns 1. Onlye one possible Index, and
that is the primarykey of the table. The other fields doesn't show up in the
IndexDefs->Items[] list. Do I have to define the index'es of the table
somewhere?
I tried to define the CustomerIp->IndexFieldNames property, but it didn't work.

Thanks again!

/Ola







"A. Ghaibeh" wrote:

> You can change the index of the table.
>
> "Ola Eriksen" <ola@callcom.no> wrote in message news:1103_1025773874@ola...
> > Hello!
> >
> > A simple question I guess :)
> >
> > Can anyone help me with some code so that I can sort the TDBGrid by the
> field the user selects.
> > I've activated the OnTitleClilck event, but I've not managed to write a
> code that works :(
> >
> > Thanks!
> >
> >
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.372 / Virus Database: 207 - Release Date: 2002/06/20
Technical Details
Message-ID: <3D244F06.55355B6@callcom.no>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <1103_1025773874@ola> <3d243436$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,6f893f24f32b7eae
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-07-04 05:41:33 PST
Message-ID: <3D244F06.55355B6@callcom.no>
Date: Thu, 04 Jul 2002 14:35:02 +0100
From: Ola Eriksen <ola@callcom.no>
X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Re: Sorting DBGrid
References: <1103_1025773874@ola> <3d243436$1_2@dnews>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 193.69.252.248
X-Trace: dnews 1025786169 193.69.252.248 (4 Jul 2002 05:36:09 -0700)
Lines: 54
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!dnews