Solved

Disable Paradox Index

Posted on 2002-07-18
12
354 Views
Last Modified: 2010-08-05
Dear Experts, please help !

     For some reason, I'd like to disable all of the index ( the primary and secondary index ) of the paradox table.

     Please help me how to do it !

Thanks from apin.

ps. I'm using D5 Enterprise and Windows ME.

In xBase version I usually do this :

Use MyTable
Set Order To 0   // ( Or set order to )
// all of the index is disabled, but not deleted
0
Comment
Question by:pc_melsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7162768
you can't disable,
only delete and recreate

meikl ;-)
0
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 7163306
As Kretzschmar say its not possible, but I think you were a Clipper Programmer or Fox, it isnt?
and you want to obtain the natural order of the registers.

If you create and Autoincrement Field, and an index for this field you will obtain the same effect.

Best Regards.
Marcos.
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7163573
Curious to why you want to do this. Are you having sorting issues you wish to change?


The Crazy One
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pc_melsa
ID: 7167845
For Mr. Meikl,
    Can't we delete primary index programatically ( during run time ) ?

Thanks.
0
 

Author Comment

by:pc_melsa
ID: 7167850
For Mr. Meikl,
  Sorry, the question should be : can we delete primary and secondary index during run time ( programmatically ) ?

Thanks.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 7167894
yes, primary at last

just use something like this

  table1.close;  //can only be done on a closed table
  table1.indexdefs.update;  //retrieve indexes
  for i := table1.IndexDefs.Count -1 downto 0 do  //through all indexes, only the secondarys
    if not (ixprimary in table1.IndexDefs[i].Options) then
      table1.DeleteIndex(table1.IndexDefs[i].Name);
  //atleast now should be only the primary key
  table1.DeleteIndex('');  //'' is the default name for paradpx primary indexes

meikl ;-)
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7167913
Actually according to the Delphi help DeleteIndex only works on secondary index's


"Deletes a secondary index for the table.

procedure DeleteIndex(const Name: String);

Description

Call DeleteIndex to remove a secondary index for a table. Name is the name of the index to delete. DeleteIndex cannot remove a primary index.

Note:     To delete an index, an application must first open the table for exclusive access."
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7167919
You may need to use a TQuery to this with the following statement.

DROP INDEX TheTable.PRIMARY

and then call the ExecSQL method

0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7167934
begin

  with TQuery.Create(nil) do begin
    try
      SQL.Text := 'DROP INDEX ''TheTable.db''.PRIMARY';
      ExecSQL;
    finally
      Free;
    end;
  end;

end;
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7167979
my code is tested, crazyone->no problem with the primary key
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7168012
Oops you are correct meikl I just tested it and it did delete the primary. It appears the Delphi Help is inaccurate about this. :>)
0
 

Author Comment

by:pc_melsa
ID: 7168606
Thank you very much !!!
Best Regards,
apin
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question