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 !
DjDMacAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.