6.9.4.2 IdentityInsert

When inserting DataSet data into the database, this property indicates whether the database generates the inserted row's identity column value or DataSet supplies this value.

Declaration

// C#
public bool IdentityInsert {get; set;}

Property Value

When set to true, ODP.NET inserts DataSet identity column values into the database. When set to false, the database determines the inserted identity column values.

Remarks

This property applies only to identity columns of type GENERATED BY DEFAULT and GENERATED BY DEFAULT ON NULL. Identity column of type GENERATED ALWAYS will ignore this property and will always use database generated values.

When set to false, the server will generate an identity value for the row. That generated identity value returns back to the client to update the DataSet value.

When this property is set to true for the GENERATED BY DEFAULT case and the application attempts to insert a NULL value into the database's identity column, the NOT NULL constraint is violated and an error occurs. ODP.NET will then allow the database to generate the identity column value and return the generated value to the DataSet.

The default value for this property is false.