Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Modify primary index
Thu, Sep 18 2008 8:17 PMPermanent Link

Roger Ruiz
Hi

I need modify primary index with the next code:

with tblCust do
 if IndexDefs.Items[0].Fields='RecordId' then   // Check index primary
 begin
   IndexDefs.Items[0].Fields:='Number';   // Change value for field Number
   AlterTable;  // This line is executed within error and nothing, no change index
 end;

The table only have a index primary.

Thanks
Roger
Fri, Sep 19 2008 6:39 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roger,

<< I need modify primary index with the next code:

with tblCust do
 if IndexDefs.Items[0].Fields='RecordId' then   // Check index primary
 begin
   IndexDefs.Items[0].Fields:='Number';   // Change value for field Number
   AlterTable;  // This line is executed within error and nothing, no
change index
 end;

The table only have a index primary. >>

Are you using DBISAM 4.x ?  If so, then the above code should work provided
that you include these two lines at the beginning:

with tblCust do
 FieldDefs.Update;  <<<<<<<<<<
 IndexDefs.Update;  <<<<<<<<<<
 if IndexDefs.Items[0].Fields='RecordId' then   // Check index primary
 begin
   IndexDefs.Items[0].Fields:='Number';   // Change value for field Number
   AlterTable;  // This line is executed within error and nothing, no
change index
 end;

--
Tim Young
Elevate Software
www.elevatesoft.com

Image