Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting records with autoincrementing primary keys

I created a MySQL database in phpMyAdmin, with an auto incrementing primary key ID. Within phpMyAdmin I can insert records via INSERT INTO MyTable VALUES (null,1,2,3) The null position is for ID.

Loading the DB data into a Delphi application (Connection->Table or Query->DataSetProvider->ClientDataSet->DataSource->DBGrid and DBNavigator), how do I insert a record without manually entering an ID value? If I don't enter a number into the ID field I get an error.

like image 202
Al C Avatar asked May 16 '13 21:05

Al C


1 Answers

Set the Required property for the field to false. This has to be done in the Table or Query and in the ClientDataSet. You have to remove the pfInUpdate from the ProviderFlags of the field, too.

like image 69
Uwe Raabe Avatar answered Oct 01 '22 01:10

Uwe Raabe