RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TAdoDbxCommandBuilder Class

Generates single-table commands as part of the operation of the TAdoDbxDataAdapter.

Pascal
TAdoDbxCommandBuilder = class(DbCommandBuilder);
C++
class TAdoDbxCommandBuilder : public DbCommandBuilder;

Borland.Data.AdoDbxClientProvider

The TAdoDbxCommandBuilder class is used to automatically generate single-table commands to reconcile changes made to a DataSet with its underlying database. 

TAdoDbxCommandBuilder implements the ADO.NET DbCommandBuilder class. 

You can generate SQL commands based on the SelectCommand property, which you must set prior to executing any of the other TAdoDbxCommandBuilder methods. The results of the SelectCommand are used to return metadata that is then used to construct the arguments to the InsertCommand, UpdateCommand, or DeleteCommand properties of TAdoDbxDataAdapter. If you want to achieve greater performance, you might want to consider using direct commands, rather than using the TAdoDbxCommandBuilder. 

If you review the SQL statements generated for the UpdateCommand and DeleteCommand, you see that they each contain a WHERE clause that specifies that the row can only be updated if it contains all original values and hasn't been deleted from the database. Records are not locked and therefore the TAdoDbxCommandBuilder operates on the basis of optimistic concurrency. If you try to update or delete a record that has been changed by another user, the operation throws a DBConcurrencyException.

Note: You can only use the TAdoDbxCommandBuilder on standalone tables. If you try to update a column that participates in a foreign-key constraint, you might encounter a failure.
Warning: SelectCommand must return at least one primary key or unique column.
 

 

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