🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Sorting DBGrid

#3675
From: Ola Eriksen
Date: Thu, 04 Jul 2002 14:27
44 lines
2354 bytes
It's working now :)

thanks!



"J.Steinecker" wrote:

> Hi,
>
> if you use a TQuery as DataSet you can search the SQL->Text AnsiString for
> an ORDER BY.
>
> If you cannot find an ORDER BY then you can append one with the
> column->FieldName.
> If you find an ORDER BY then you can do different ways. In case it is the
> same column I change the sort order from ascending to descending or vice
> versa. In the other case you can change the sort column.
> After that I close and reopen the manipulated query to do the sorting.
>
> You have to think about some problems. You can have comments in the SQL
> statement what you have to take into consideration on searching for the
> ORDER BY. If you use calculated fields in your query then you get the
> gridname in the OnTitleClick event, but on which column is to sort?
> So I provided a method to produce an additional list which makes a mapping
> between gridcolumns and querycolumns.
>
> HTH
> Juergen
>
> "Ola Eriksen" <ola@callcom.no> schrieb im Newsbeitrag
> 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!
> >
> >
Technical Details
Message-ID: <3d245a33$4_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!12.127.17.134.MISMATCH!attbtf!ip.att.net!wn3feed!worldnet.att.net!128.230.129.106!news.maxwell.syr.edu!bnewspeer01.bru.ops.eu.uu.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <1103_1025773874@ola> <3d244532_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:44 PST
Date: Thu, 04 Jul 2002 15:27:15 +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> <3d244532_2@dnews>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 45
NNTP-Posting-Host: 130.78.143.1
Message-ID: <3d245a33$4_2@dnews>
X-Trace: dnews 1025792563 130.78.143.1 (4 Jul 2002 07:22:43 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!12.127.17.134.MISMATCH!attbtf!ip.att.net!wn3feed!worldnet.att.net!128.230.129.106!news.maxwell.syr.edu!bnewspeer01.bru.ops.eu.uu.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!dnews