NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

ADODataSetCommand.InsertCommand

Gets or sets a command used to insert new records into the data source.

[Visual Basic]
Public Property InsertCommand As ADOCommand
[C#]
public ADOCommand InsertCommand {get; set;}
[C++]
public: __property ADOCommand* get_InsertCommand();
public: __property void set_InsertCommand(ADOCommand*);
[JScript]
public function get InsertCommand() : ADOCommand;
public function set InsertCommand(ADOCommand);

Property Value

An ADOCommand used during Update to insert records in the data source for new rows in the data set.

Example [Visual Basic]

The following example creates an ADOCommand used to set the InsertCommand property for use by the ADODataSetCommand.

[Visual Basic]

Sub AssignInsertCommand ()
   Dim myConnection As ADOConnection
   Dim adoDataSetComm As ADODataSetCommand
   Dim myConnectStr As String
   Dim myInsComm As String
   ' Initialize the ADODatSetCommand
   adoDataSetComm = New ADODataSetCommand
   ' Assign myConnectStr to the connection string
   myConnectStr = "Provider=SQLADO.1;User ID=sa;PASSWORD=;" _
    + "Initial Catalog=Northwind;Data Source=vbsql7;"
   ' Initialize the ADOConnection
   myConnection = New ADOConnection myConnectStr
   ' Assign myInsComm to the text of my insert command
   myInsComm = "INSERT INTO tblCustomer (vchFirstName, " _
 + "vchLastName, chState) VALUES (?, ?, ?)"
   ' Assign the InsertCommand to myInsComm
   adoDataSetComm.InsertCommand.CommandText = myInsComm
   ' Set the command's connection to the current connection
   Set adoDataSetComm.InsertCommand.ActiveConnection = myConnection
End Sub

See Also

ADODataSetCommand Class | ADODataSetCommand Members | System.Data.ADO Namespace | DeleteCommand | SelectCommand | UpdateCommand