views:

97

answers:

2

Im using BDE.... How can i sort a table by given field?

A: 

Not familiar with BDE - but if it supports standard SQL the order by FIELD_NAME should work fine.

RonK
+1  A: 

So, firstly my assumtion is you are using a TTable component.

Easy way...

Use a TQuery component instead of a TTable component and let the database do the heavy lifting for you with a order by clause.

Hard way....

you can use the DbiSortTable function (declared in the DbiProcs.int file) you can google that for some sample code.

Now, having said all of that, if you have the opportunity, you should think about migrating away from the BDE, it's deprecated and there are vastly better database connectivity mechanisms available for Delphi, Embarcadero would recommend DBEXpress as a better way to go.

Tim Jarvis