Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread add autoInc to primary key
Thu, Sep 4 2014 4:54 AMPermanent Link

Kees

I've taken over a Delphi project and I want to restructructure the field 'id'. The field id now has a primary index on it. I want to make the field autoInc. There are no other autoInc fields in the table. The table has format version 3.0 and dbisam is version 3.3. In dbsys says the last autoInc value is 101352.
This is what I've done: remove the field id, close the table, open the table, add the field id, add a primary key, set autoInc=true. No erorrs.
But when I added a record the numbering of id starts with 101352.
I tried the whole procedure also with repair table on the starting table, on the restructured table and on both versions of the table, but it made no difference.
If I change the 'last autoInc value' in dbSys everything works fine. Unfortunatly the tables are filled by users of the program. So I can't use dbSys, I have to change the last autoInc value programmatically. But how?
Thu, Sep 4 2014 5:54 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Kees


I can see in the manual how to do it in version 4, but I think things changed between V3 & V4. If you search the pdf version of the manual for your version of DBISAM for lastautoinc does it give any clues? If not the only other thing I can suggest is examine the source of DBSys. Its just another Delphi program and you should be able to copy and alter what it does for needs.

Roy Lambert
Thu, Sep 4 2014 7:26 AMPermanent Link

Raul

Team Elevate Team Elevate

On 9/4/2014 4:54 AM, Kees wrote:
> If I change the 'last autoInc value' in dbSys everything works fine. Unfortunatly the tables are filled by users of the program. So I can't use dbSys, I have to change the last autoInc value programmatically. But how?

In dbisam 3 you have to use the RestructureTable function and it allows
you to specify new autoinc value using parameter "NewLastAutoincValue".

It looks like this function already (since you are dropping and adding
fields) so just make sure you specify this during the call and specify 0
there.

Raul

Sat, Sep 6 2014 7:54 AMPermanent Link

Kees

Raul wrote:

.....
In dbisam 3 you have to use the RestructureTable function and it allows
you to specify new autoinc value using parameter "NewLastAutoincValue".
......

I missed this parameter.
Thanks!

Kees
Image