The ODAC supports automatic generation of table primary key functions through Oracle's sequence. This process allows automatic completion on the client side without the need for too much code. This is useful for situations where it is required to automatically grow field keys. Its implementation steps are:
1. The database must first establish a sequence that generates a primary key.
2. Set the Keysequence property of the dataset, pointing to the sequence in the database.
3. Set the Sequencemode property of the dataset, which explicitly generates the sequence value when it is added or modified, and assigns a value to the primary key of the dataset.
4. Set the Keyfields property of the dataset and point to the key field of the table. If there are multiple fields in Keyfields, the sequence values are automatically assigned to the first field.
ODAC (V9.5.15) Learning Note (19) primary key value auto-generated