Getting Pk on insert

Getting Pk on insert

Postby degas » Wed 24 Nov 2010 17:49

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.
degas
 
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Postby Shalex » Fri 26 Nov 2010 14:55

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.
Shalex
Devart Team
 
Posts: 7839
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle