RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TAdoDbxDataAdapter.InsertCommand Property

A TAdoDbxCommand used during Update to insert records into the database that correspond to new rows in the DataSet.

Pascal
property InsertCommand: TAdoDbxCommand;
C++
__property TAdoDbxCommand InsertCommand;

This property contains a SQL INSERT statement that you specify. This property acts as a form of shorthand, allowing you to store an INSERT statement that you expect to use multiple times.  

During Update, if you don't set this property and if primary key information is present in the DataSet, you can generate the InsertCommand automatically by setting the SelectCommand property and using the TAdoDbxCommandBuilder. Then, any additional commands that you do not set are generated by the TAdoDbxCommandBuilder. This generation logic requires key column information to be present in the DataSet.  

If execution of this command returns rows, they can be added to the DataSet depending on how you set the UpdatedRowSource property of the TAdoDbxCommand object.

Note: When you assign InsertCommand to a previously created TAdoDbxCommand, the TAdoDbxCommand is not cloned. The InsertCommand maintains a reference to the previously created TAdoDbxCommand object.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!