OdbcDataAdapter::InsertCommand Property
Gets or sets an SQL statement or stored procedure used to insert new records into the data source.
Assembly: System.Data (in System.Data.dll)
public: property OdbcCommand^ InsertCommand { OdbcCommand^ get(); void set(OdbcCommand^ value); }
Property Value
Type: System.Data.Odbc::OdbcCommand^An OdbcCommand used during an update operation to insert records in the data source that correspond to new rows in the DataSet.
When the InsertCommand property is assigned to a previously created OdbcCommand object, the OdbcCommand is not cloned. Instead, InsertCommand maintains a reference to the previously created OdbcCommand.
During an update operation, if InsertCommand is not set and primary key information is present in the DataSet, you can use the OdbcCommandBuilder class to automatically generate InsertCommand, and additional commands needed to reconcile the DataSet to the data source. To do this, set the SelectCommand property of the OdbcDataAdapter. The generation logic also requires key column information to be present in the DataSet. For more information, see Generating Commands with CommandBuilders.
Note |
|---|
If execution of this command returns rows, these rows may be added to the DataSet depending upon how you set the UpdatedRowSource property of the OdbcCommand object. |
The following example creates an OdbcDataAdapter and sets the SelectCommand and InsertCommand properties. It assumes that you have already created an OdbcConnection object.
Available since 1.1
