• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

Sorting database and Query results..

I use Paradox table in my program, and I use SQL to do searches.

Problem is this:

Who can i sort the table and query results in DBGrid by one or more fields?

When I try to set the IndexFields, I get error 'no index file for field XXX'

My original table has no index fields set, and even if I set the index property in Database Desktop and move all data to this new table with the index fields set, it won't work.

How do i create these index files etc. ?

SQL line 'ORDER BY <field>' gives the same error message. So there is a problems with the index files..

Help me !
0
DjDMac
Asked:
DjDMac
  • 7
  • 6
1 Solution
 
kretzschmarCommented:
hi djdmac,

you can multiple sort with a query by using a order by clause. In this case there is no need of an index.

>SQL line 'ORDER BY <field>' gives the same error message.

does the <field> really exist?
do you use the physical fieldname?

if you leave your email-address here, then i can send you a sample, which is sorting on the fly by clicking on the dbgrid column-title for all columns.

meikl
0
 
DjDMacAuthor Commented:
<field> really exists.
I have tried physical field name and order number. Both gives same result, error message.

my email is: djdmac@hotmail.com, i would like to have that sample code!
0
 
kretzschmarCommented:
well,

i send it in ~9 hours,
when i'm back in my homeoffice.
(be patient, just went on work, its early in the moring here)

in the meantime,
can you show some code
how you try the sort?

meikl
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
DjDMacAuthor Commented:
Well, i dont have any special source, in IDE i tried to change the Table components IndexFieldName and IndexDefs propertys.. And in search functions SQL strings i tried to add 'ORDDER BY' clause.

If you want you can get the database from my ftp site.
194.111.55.211:21 anonymous
I will create a DATABASE directory there..

0
 
kretzschmarCommented:
well,

i download it at todays evening,
because the firewall at the company where i work doesn't allow me the download yet.

meikl
0
 
DjDMacAuthor Commented:
Well, I'm at work too, and i'm here about 4 hours and then i must go home, and i will close the FTP site. So are you able to get it before that ? If not i can also email it to you. The zip file is only about 300-400k.
0
 
kretzschmarCommented:
nope,

i must stay here ~7 hours from now, therefore send it to

meikl@spektracom.de

meikl
0
 
kretzschmarCommented:
hi djdmac,
did you received the sample?
meikl
0
 
DjDMacAuthor Commented:
Yes.. thanx..

It works, but too slow..
Can you help me with the indexes ?
Am i right, that indexes makes it faster and also makes searching faster ?
0
 
kretzschmarCommented:
hi djdmac,

>Am i right, that indexes makes it
>faster and also makes searching
>faster ?

yup,

just create a primary index first with the database-desktop (restructure table)

mark each column with * from beginning until a record is described unique.

then cerate the secondary indexes (combobox), select the coloumn, the sortorder and give the index a name.

save (restructure) the table.

now you can set at runtime the indexname (your given name) to perform the sorting.

i will do sample at evening and send it to you again.

meikl
0
 
florisbCommented:
No help but;

I worked with paradox tables once.

ORDER BY Name in the SQL did work (I just checked my old source)....

But you have to use Name then too in de SELECT statement....
....hmmm.



0
 
kretzschmarCommented:
second sample sent
0
 
DjDMacAuthor Commented:
Thank you kretzschmar !

Your example was great !
It really is fast, when using indexes..
I got the points.

Lazy Jeff
0
 
DjDMacAuthor Commented:
Thanx one more time !
My project is up and running again..
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now