Board index » delphi » Key violation for auto increment Primary keys
Ashish
![]() Delphi Developer |
Sat, 22 Jun 2002 03:00:00 GMT
|
Ashish
![]() Delphi Developer |
Sat, 22 Jun 2002 03:00:00 GMT
Key violation for auto increment Primary keys
Key Violation is constantly coming for the Paradox 7.0 Tables, if an
autoincrement field is set as the Primary Key . The only way I find to sort this Problem is to go to Database Desktop Change that field to Integer and then change it back to AutoInc. But I can,t give this instructions to my customers. There is any way to sort it out and why this is coming. Please help me.. Thanks in advance |
Sundial Service
![]() Delphi Developer |
Sat, 22 Jun 2002 03:00:00 GMT
Re:Key violation for auto increment Primary keysIt sounds like the "next autoincrement field value" in the table header is incorrect. Try downloading our ChimneySweep product and running it against the table. With the AVF feature turned on, it will detect the maximum value used in the autoincrement field and ensure that the "next field value" in the header actually exceeds the maximum field-value found. It'll reset the counter in the header if the value is wrong. [I make this suggestion quite seriously... no spamming is involved: I'm Now, you still need to try to figure out -why- this problem is happening Quote>Ashish wrote: Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259 mailto:i...@sundialservices.com (PGP public key available.) Quote> Why =shouldn't= it be quick and easy to keep your database online? |
Team
![]() Delphi Developer |
Sat, 22 Jun 2002 03:00:00 GMT
Re:Key violation for auto increment Primary keysCan you give a little more info on what you are trying to do? When you create a record with an autoincrement key, the key is not filled in until you post. Therefore, if you try to use a reference to the record before it is posted, then you may get such an error as the key will be zero until it is posted. Could this be your problem or is it something else? -- Quote"Ashish" <d...@vsnl.com> wrote in message Quote> Key Violation is constantly coming for the Paradox 7.0 Tables, if an |
Team
![]() Delphi Developer |
Sat, 22 Jun 2002 03:00:00 GMT
Re:Key violation for auto increment Primary keysThis is a symptom of table corruption. If this is a multiuser app make sure the BDE is configured as described in TI247B at www.borland.com/devsupport/bde/ti. Other possible causes are system crashes or network hardware problems. -- Bill Todd (TeamB) |
Roman Krejc
![]() Delphi Developer |
Sun, 23 Jun 2002 03:00:00 GMT
Re:Key violation for auto increment Primary keysHi Ashish, Pdxrbld utility (free) stored at my website http://www.rksolution.cz/delphi/delphi.htm does repair this kind of Paradox table corruption -- Roman (please remove 'stopspam' in header when replying) mail: i...@rksolution.cz URL: www.rksolution.cz Ashish <d...@vsnl.com> p1e v diskusnm Quote> Key Violation is constantly coming for the Paradox 7.0 Tables, if an |
Ashis
![]() Delphi Developer |
Mon, 24 Jun 2002 03:00:00 GMT
Re:Key violation for auto increment Primary keyswhen the Table is corrupted, I tried adding a record in Database desktop but there also autoincrement primary key is not updating and gives me key violation Quote>> Thanks in advance |
Tim Davie
![]() Delphi Developer |
Mon, 24 Jun 2002 03:00:00 GMT
Re:Key violation for auto increment Primary keysQuoteAshish <d...@vsnl.com> wrote in message Quote> when the Table is corrupted, I tried adding a record in Database desktop get the Session.PrivateDir set correctly at application load time. You might also find the following code useful. It sets an AutoInc to Integer and back. The TfmCMSReindex is real the rest is the examples that I found via the Borland BDE site. You will need to have deleted the promary index, then opened the table and finally recreated the primary index (on the AutoInc field) before you do the DbiDoRestructure. <<<Snip Start>>> ChangeField(Table1, Table1.FieldByName('FOO'), MyChangeRec) Quote} var ChangeRecord : TChangeRec; begin try with ChangeRecord do begin szName := 'ITEMNO'; iType := fldINT32; iSubType := 0; iLength := 0; iPrecision := 0; end; ChangeField(tblReindex, tblReindex.FieldByName(ChangeRecord.szName) , ChangeRecord); finally tblReindex.Open; with ChangeRecord do begin szName := 'ITEMNO'; iType := fldINT32; iSubType := fldstAUTOINC; iLength := 0; iPrecision := 0; end; ChangeField(tblReindex, tblReindex.FieldByName(ChangeRecord.szName) , ChangeRecord); end; end; procedure TfmCMSReindex.ChangeField(Table: TTable; Field: TField; Rec: begin Check(DbiSetProp(hDBIObj(Table.Handle), curxltMODE, integer(xltNONE))); // If the szName portion of the ChangeRec has something in it, change for B := 1 to Table.FieldCount do begin // Blank out the structure... // Set the field count for the table <<<Snip End>>> |
Ashis
![]() Delphi Developer |
Fri, 28 Jun 2002 03:00:00 GMT
Re:Key violation for auto increment Primary keysThis time I can't even open that Corrupted table. I tried re-indexing the keys but the table is not opening. when i tried rebuild it gives me an error block size mismatch. Ashish |
1. Need Help With Auto-Increment Primary Key Errors
2. Auto-increment primary key in SQL 7.0 vs TDBGrid
3. Paradox key violations on auto-increment field
4. Auto-increment key violations over the network
5. Auto Increment Key Violation
6. Primary key or not primary key.........
7. MS Access Auto incrementing Key fields
8. How to return auto-increment key??