Solved

AutoIncrement Access from BDE

Posted on 1997-06-03
3
280 Views
Last Modified: 2010-04-06
Greetings,

We have an autoincrement field in a file (BDE/PARADOX) that has been set to a low value (how, is unknown at the moment).  We would like to be able to rewrite the header of the file so that the autoincrement field is set to a non-duplicate (proper) value again.  The code to get the largest existing value is a piece of cake.  The challenge is to rewrite the header with this value.  Anyone have any ideas?  The goal would be to write code to do this (rewrite the header).  We can not rewrite the file out since the autoincrement fields would be renumbered (other files need the existing numbers).

Thanks in advance....

John Wilson
Senior Software Engineer
PACS Software, Inc.
jwilson@pacsusa.com
0
Comment
Question by:PACS
[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
3 Comments
 

Author Comment

by:PACS
ID: 1336793
This can be done through the database desktop by restructuring the table -- setting the minimum value for the auto-increment field, adding a record, and clearing the minimum value.  Would be nice to do in code though.  I've got the core of the program done... available BDE (doesn't work with normal Delphi calls) documentation is not good.  Any example of adding a minimum value to a file before the restructuring (dbidorestructure) in code would be useful.  jw (06/03/97).

0
 
LVL 1

Expert Comment

by:ygolan
ID: 1336794
John,

Just a suggestion - refrain from using Autoincrement fields as keys. If your table gets corrupted and you need to rebuild it, getting the BDE to use exactly the same values for the AI fields is very difficult.
0
 

Accepted Solution

by:
JGREER earned 200 total points
ID: 1336795
1. Rebuild the table (Autoincrement header info is either lost or incorrect.

2. Restructure the table setting the Autoincrement field(s) to 'I'nteger types.

3. Save the table.

4.  Restructure the table setting the Autoincrement field(s) back to AutoIncrement and save the table again.

5. The next record added will be last value +1

0

Featured Post

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!

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 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