Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • Last Modified:

Disable Paradox Index

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
pc_melsa
Asked:
pc_melsa
  • 5
  • 3
  • 3
  • +1
1 Solution
 
kretzschmarCommented:
you can't disable,
only delete and recreate

meikl ;-)
0
 
marcoszorrillaCommented:
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
 
CrazyOneCommented:
Curious to why you want to do this. Are you having sorting issues you wish to change?


The Crazy One
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
pc_melsaAuthor Commented:
For Mr. Meikl,
    Can't we delete primary index programatically ( during run time ) ?

Thanks.
0
 
pc_melsaAuthor Commented:
For Mr. Meikl,
  Sorry, the question should be : can we delete primary and secondary index during run time ( programmatically ) ?

Thanks.
0
 
kretzschmarCommented:
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
 
CrazyOneCommented:
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
 
CrazyOneCommented:
You may need to use a TQuery to this with the following statement.

DROP INDEX TheTable.PRIMARY

and then call the ExecSQL method

0
 
CrazyOneCommented:
begin

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

end;
0
 
kretzschmarCommented:
my code is tested, crazyone->no problem with the primary key
0
 
CrazyOneCommented:
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
 
pc_melsaAuthor Commented:
Thank you very much !!!
Best Regards,
apin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now