Gets or sets a command to insert new records into the data source.
[Visual Basic] Public Property InsertCommand As SQLCommand [C#] public SQLCommand InsertCommand {get; set;} [C++] public: __property SQLCommand* get_InsertCommand(); public: __property void set_InsertCommand(SQLCommand*); [JScript] public function get InsertCommand() : SQLCommand; public function set InsertCommand(SQLCommand);
A SQLCommand used during Update to insert records into the data source to reflect the new rows in the data set.
The following example creates a SQLCommand used to set the InsertCommand property to be used by the SQLDataSetCommand.
[Visual Basic]
Sub AssignInsertCommand () Dim myConnection As SQLConnection Dim sqlDataSetComm As SQLDataSetCommand Dim myConnectStr As String Dim myInsComm As String ' Initialize the SQLDatSetCommand 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 myInsComm to the text of my insert command myInsComm = "INSERT INTO tblCustomer (vchFirstName, " _ + "vchLastName, chState) VALUES (?, ?, ?)" ' Assign the InsertCommand to myInsComm sqlDataSetComm.InsertCommand.CommandText = myInsComm ' Set the command's connection to the current connection Set sqlDataSetComm.InsertCommand.ActiveConnection = myConnection End Sub
SQLDataSetCommand Class | SQLDataSetCommand Members | System.Data.SQL Namespace | DeleteCommand | SelectCommand | UpdateCommand