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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With