Solved

AutoIncrement Access from BDE

Posted on 1997-06-03
3
271 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
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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…

770 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