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