Data | When database DbDataAdapter calls the Update method, DataAdapter analyzes the changes made and executes the appropriate command (INSERT
, UPDATE, or DELETE). When DataAdapter encounters a change to DataRow, it uses InsertCommand,
UpdateCommand or DeleteCommand to handle the change. This allows you to specify command syntax at design time and, if possible
To maximize the performance of ado.net applications by using stored procedures. You must explicitly set these lives before calling Update
Make. If you call update but do not have a corresponding command for a specific update (for example, there is no
DeleteCommand), an exception is thrown.
However, if the DataTable is mapped to a single database table or generated from a single database table, you can take advantage of the CommandBuilder object
Automatic generation of DataAdapter DeleteCommand, InsertCommand, and UpdateCommand. To generate commands automatically, you must
You must set the SelectCommand property, which is the minimum requirement. SelectCommand The table schema retrieved determines which inserts are automatically generated
, UPDATE, and DELETE statements. If you modify the SelectCommand after the INSERT, UPDATE, or delete command is automatically generated
CommandText, an exception may occur. If the modified SelectCommand.CommandText contains schema information and automatic
The selectcommand.commandtext used to generate the INSERT, UPDATE, or delete command is inconsistent, then the
A call to the DataAdapter.Update method might attempt to access a column that does not already exist in the current table referenced by SelectCommand, and
Throws an exception. You can refresh CommandBuilder by calling the CommandBuilder RefreshSchema method to automatically live
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.