且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MS Access的自定义主键

更新时间:2023-02-12 09:27:33

实际上,如果使用2010或更高版本,则可以创建表触发器.表触发器可以使用某个字段(从中获取abc),然后使用其他字段(seq num),然后将值加+1.

Actually, you could create a table trigger if using 2010 or later. The table trigger could take some field (where you get the abc from) and then some other field (seq num) and then add + 1 to the value.

空中"代码如下所示:

表触发器的优点在于它在表(数据引擎)级别运行,因此,如果您使用ODBC,VB.net,FoxPro,Access等打开数据库,则PK密钥将始终为您自动生成.

The beauty of the table trigger is it runs at table (data engine) level, and thus if you open the database with ODBC, VB.net, FoxPro, Access etc. then the PK key will always auto generate for you.