本文介绍了使用自动增量主键插入记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在phpMyAdmin中创建了一个MySQL数据库,自动递增主键ID。在phpMyAdmin中,我可以通过 INSERT INTO MyTable VALUES(null,1,2,3)插入记录空位置用于ID。

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.

将数据库数据加载到Delphi应用程序(Connection-> Table或Query-> DataSetProvider-> ClientDataSet-> DataSource-> DBGrid和DBNavigator)没有手动输入ID值的记录?如果我没有在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.

推荐答案

假。这必须在表或查询和ClientDataSet中完成。您还必须从字段的ProviderFlags中删除pfInUpdate。

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.

这篇关于使用自动增量主键插入记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 12:46
查看更多