Update the database using DataAdapter and DataSet

xiaoxiao2021-03-06  115

DBDataAdapter When calling the Update method, DataAdapter analyzes the made changes and executes the corresponding command (Insert)

, Update or delete). When DataAdapter encounters changes to DataRow, it will use INSERTCOMMAND.

UpdateCommand or deleteCommand to process the change. This way, you can specify the command syntax when designing and maybe

Try to improve the performance of the ADO.NET application by using a stored procedure. You must explicitly set these lives before calling Update.

make. If Update is called, there is no corresponding command for a specific update (for example, there is no need for deleted row.

DeleteCommand will cause an exception. But if DataTable is mapped to a single database table or generated from a single database table, you can use the CommandBuilder object.

Automatically generate DataAdapter deleteCommand, INSERTCOMMAND, and UPDATECMMAND. In order to automatically generate commands, it must

You must set the selectcommand property, which is the lowest requirements. SelectCommand retrieves the table architecture to determine automatically generated INSERT

, The syntax of the Update and the delete statement. Modify SelectCommand after automatically generating insert, update, or delete commands

CommandText may have an exception. If the architecture information included in SelectCommand.comMandText is included in SELECTCOMMAND.COMMANDText

Generating the selectcommand.commandtext used when the insert, update, or delete command is inconsistent, then

The call of the DataAdapter.Update method may try to access the columns that have not existed in the current table referenced by SelectCommand, and will

Exporting exception. You can refresh the CommandBuilder by calling the RefreshSchema method of CommandBuilder.

Architecture information of the command.

转载请注明原文地址:https://www.9cbs.com/read-102785.html

New Post(0)