🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages Started by Jeffrey D. Warsaw Thu, 26 Apr 2001 21:04
DBGRID display order with indexes
#5508
Author: Jeffrey D. Warsaw
Date: Thu, 26 Apr 2001 21:04
12 lines
1813 bytes
I created a table using interbase that has a PRIMARY KEY consisting of a
field named "symbol" that is a VARCHAR (8) and "price" that is DOUBLE
PRECISION.  I then created a non unique DESCENDING index on the "price"
field because I want the records to be displayed in DESCENDING price
order.  I then created a Builder 3 application with a TTable,
TDataSource and TDBGrid attached to this interbase table and set the
index to the DESCENDING index described above.  My problem is that the
grid seems to display the records in PRIMARY KEY order no matter what I
do.  Is it possible to get the TDBGrid to display the records in a
particular order other than PRIMARY KEY order?  Are these type of
indexes only relevant for traversing the table using the ->first(),
->next(), etc. methods?
Re: DBGRID display order with indexes
#5510
Author: Mark Cashman
Date: Fri, 27 Apr 2001 03:34
20 lines
1675 bytes
Hi, Jeffrey!

TTable is a BDE component, so you should really ask your question in
borland.public.cppbuilder.database.desktop

However, my guess is that you need to select the IndexName property in
the TTable component for the index you want used if you haven't done
that.

If you use a TQuery, you need to use the ORDER BY clause in the SQL
statement.

------
Mark Cashman (TeamB - C++ Builder), creator of The Temporal Doorway at
http://www.temporaldoorway.com
- Original digital art, writing, music and more -
C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
(Join us!)
http://www.temporaldoorway.com/programming/index.htm
------
Re: DBGRID display order with indexes
#5515
Author: Jeffrey D. Warsaw
Date: Fri, 27 Apr 2001 19:14
34 lines
2207 bytes
Mark, thanks for the response, I appreciate it.  I'll post a copy in the
newsgroup
you suggested.  I tried setting the IndexName and IndexField properties
but that
didn't make any difference.  I modified the TIndexDefs also to no avail.
I read
up on indexes in the Interbase documentation and it implied that these
indexes
are really only useful for selects and that the ascending / descending had
to do
with the ordering of the select, not display order of the table.

Mark Cashman wrote:

> Hi, Jeffrey!
>
> TTable is a BDE component, so you should really ask your question in
> borland.public.cppbuilder.database.desktop
>
> However, my guess is that you need to select the IndexName property in
> the TTable component for the index you want used if you haven't done
> that.
>
> If you use a TQuery, you need to use the ORDER BY clause in the SQL
> statement.
>
> ------
> Mark Cashman (TeamB - C++ Builder), creator of The Temporal Doorway at
> http://www.temporaldoorway.com
> - Original digital art, writing, music and more -
> C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
> (Join us!)
> http://www.temporaldoorway.com/programming/index.htm
> ------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads