MySQL Forums
Forum List  »  Delphi

Key Violations
Posted by: Ed Allahverdian
Date: April 26, 2006 01:38PM

When I try to add records using a dbgrid and dbexpress Clientdataset D7 and Corelab dbexpress driver into a table with Auto_increment field, I get a "key violation" error on the second record entry.

For test I used the table in MySQL documentaion examples

CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
);

When I insert data in the MySQL query Browser it works

INSERT INTO animals (name) VALUES
('dog'),('cat'),('penguin'),
('lax'),('whale'),('ostrich');

The same insert statement works with my form when I add it to a SQLQuery and do SQLQuery.execSQL() with a button;
This will work as many times as you click the botton.

But when I add data in the grid I get Key Violation on the second entry!

I have set the id field Providerflags Pfinwhere and PfinKey = True!

Can any one tell me whats wrong please?

Thanks,

Ed

Options: ReplyQuote


Subject
Written By
Posted
Key Violations
April 26, 2006 01:38PM
May 12, 2006 06:30AM
May 21, 2006 05:39PM
May 22, 2006 03:46AM
May 24, 2006 06:42AM
May 25, 2006 02:52AM
May 25, 2006 08:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.