Gets or sets a command used to select records in the data source.
[Visual Basic] Public Property SelectCommand As ADOCommand [C#] public ADOCommand SelectCommand {get; set;} [C++] public: __property ADOCommand* get_SelectCommand(); public: __property void set_SelectCommand(ADOCommand*); [JScript] public function get SelectCommand() : ADOCommand; public function set SelectCommand(ADOCommand);
An ADOCommand that is used during Update to select records from data source for placement in the data set.
The following example creates an ADOCommand used to set the SelectCommand property for use by the ADODataSetCommand.
[Visual Basic]
Sub AssignSelectCommand () Dim myConnection As ADOConnection Dim myConnectStr As String Dim mySelectComm As String Dim adoDataSetComm As ADODataSetCommand ' Initialize the ADODataSetCommand 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 mySelectComm to the text of my select command mySelectComm = "SELECT intID, vchFirstName, vchLastName, " _ + "chState FROM Customers WHERE chState = 'CA'" ' Assign the DeleteCommand to myDelComm adoDataSetComm.SelectCommand.CommandText = mySelectComm ' Set the command's connection to the current connection Set adoDataSetComm.SelectCommand.ActiveConnection = myConnection End Sub
ADODataSetCommand Class | ADODataSetCommand Members | System.Data.ADO Namespace | DeleteCommand | InsertCommand | UpdateCommand