What is the use of Command builder?
- Command builder generates insert/update/delete commands for data adapter based on select command.
- Automatic creation of insert/update/delete commands hinders performance.
- The command builder uses select command property of data adapter to determine values for other commands.
- Command builder builds “Parameter” objects automatically.
Example:Dim pobjCommandBuilder As New OleDbCommandBuilder(pobjDataAdapter)
pobjCommandBuilder.DeriveParameters(pobjCommand)
- If the DeriveParameters method is used, an extra trip to the Datastore is made which can highly affect the efficiency.
- It is used to build complex queries.
- It can even build commands that are based on the returned results.
- Command builder is less error prone and more readable than the command object.