Article View: borland.public.cppbuilder.database.ado
Article #3677Re: Sorting DBGrid
From: Ola Eriksen
Date: Thu, 04 Jul 2002 13:35
Date: Thu, 04 Jul 2002 13:35
53 lines
2381 bytes
2381 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:
<3d245a1a$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!DirecTVinternet!DirecTV-DSL!gestalt.direcpc.com!cyclone2.usenetserver.com!usenetserver.com!ps01-sjc1!news.webusenet.com!news.tele.dk!small.news.tele.dk!213.73.101.75!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<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 07:43:56 PST 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 Lines: 54 NNTP-Posting-Host: 130.78.143.1 Message-ID: <3d245a1a$1_1@dnews> X-Trace: dnews 1025792538 130.78.143.1 (4 Jul 2002 07:22:18 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!DirecTVinternet!DirecTV-DSL!gestalt.direcpc.com!cyclone2.usenetserver.com!usenetserver.com!ps01-sjc1!news.webusenet.com!news.tele.dk!small.news.tele.dk!213.73.101.75!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!dnews