Gets or sets a command used to update records in the data source.
[Visual Basic] Public Property UpdateCommand As SQLCommand [C#] public SQLCommand UpdateCommand {get; set;} [C++] public: __property SQLCommand* get_UpdateCommand(); public: __property void set_UpdateCommand(SQLCommand*); [JScript] public function get UpdateCommand() : SQLCommand; public function set UpdateCommand(SQLCommand);
An SQLCommand used during Update to update records in the data source to reflect modified rows in the data set.
The following example creates a SQLCommand used to set the UpdateCommand property to be used by the SQLDataSetCommand.
[Visual Basic]
Sub AssignUpdateCommand () Dim myConnection As SQLConnection Dim myConnectStr As String Dim myUpdateComm As String Dim sqlDataSetComm As SQLDataSetCommand ' Initialize the SQLDataSetCommand sqlDataSetComm = New SQLDataSetCommand ' Assign myConnectStr to the connection string myConnectStr = "Provider=SQLSQL.1;User ID=sa;PASSWORD=;" _ + "Initial Catalog=Northwind;Data Source=vbsql7;" ' Initialize the SQLConnection myConnection = New SQLConnection myConnectStr ' Assign myUpdateComm to the text of my update command myUpdateComm = "DELETE FROM tblCustomer WHERE intID = ?" ' Assign the UpdateCommand to myUpdateComm sqlDataSetComm.UpdateCommand.CommandText = myUpdateComm ' Set the command's connection to the current connection Set sqlDataSetComm.UpdateCommand.ActiveConnection = myConnection End Sub
SQLDataSetCommand Class | SQLDataSetCommand Members | System.Data.SQL Namespace | DeleteCommand | InsertCommand | SelectCommand