System.Data.SqlClient.SqlDataAdapter.UpdateCommand Property

Gets or sets a Transact-SQL statement or stored procedure used to update records in the data source.

Syntax

[System.ComponentModel.Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.DefaultValue(null)]
public SqlCommand UpdateCommand { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

During System.Data.Common.DbDataAdapter.Update(System.Data.DataSet), if this property is not set and primary key information is present in the System.Data.DataSet, the SqlDataAdapter.UpdateCommand can be generated automatically if you set the SqlDataAdapter.SelectCommand property and use the System.Data.SqlClient.SqlCommandBuilder. Then, any additional commands that you do not set are generated by the System.Data.SqlClient.SqlCommandBuilder. This generation logic requires key column information to be present in the System.Data.DataSet. For more information, see Automatically Generated Commands.

When SqlDataAdapter.UpdateCommand is assigned to a previously created System.Data.SqlClient.SqlCommand, the System.Data.SqlClient.SqlCommand is not cloned. The SqlDataAdapter.UpdateCommand maintains a reference to the previously created System.Data.SqlClient.SqlCommand object.

Note:

If execution of this command returns rows, the updated rows may be merged with the System.Data.DataSet depending on how you set the UpdatedRowSource property of the System.Data.SqlClient.SqlCommand object.

For every column that you propagate to the data source on System.Data.Common.DbDataAdapter.Update(System.Data.DataSet), a parameter should be added to InsertCommand, UpdateCommand, or DeleteCommand.

The SourceColumn property of the parameter should be set to the name of the column. This indicates that the value of the parameter is not set manually, but taken from the particular column in the currently processed row.

Requirements

Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0