Page 1 of 1
Getting Pk on insert
Posted: Wed 24 Nov 2010 17:49
by degas
I am using DevArt DataSets and i want to recover the value of the primary key when a record is inserted. In the datase there is a trigger with a sequence.
Posted: Fri 26 Nov 2010 14:55
by Shalex
You should add the RETURNING clause to your insert statement. For this, please refer to the
Using DataSet Wizard tutorial: on the 3d step select your data table and press the "Configure commands" button, navigate to the "Command Generator" tab, press the "Get Table Fields" button, in the "Refreshing" column select a checkbox against your autoincrement field and clear all other checkboxes in this column, in the Options area check "With refresh SQL" for insert command, press the "Generate Commands" button. As a result, the insert statement will include the RETURNING clause for your autoincrement field.