SqlDataAdapter::SelectCommand Property

 

Gets or sets a Transact-SQL statement or stored procedure used to select records in the data source.

Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public:
property SqlCommand^ SelectCommand {
	SqlCommand^ get();
	void set(SqlCommand^ value);
}

Property Value

Type: System.Data.SqlClient::SqlCommand^

A SqlCommand used during Fill to select records from the database for placement in the DataSet.

When SelectCommand is assigned to a previously created SqlCommand, the SqlCommand is not cloned. The SelectCommand maintains a reference to the previously created SqlCommand object.

If the SelectCommand does not return any rows, no tables are added to the DataSet, and no exception is raised.

The following example creates a SqlDataAdapter and sets the SelectCommand, InsertCommand, UpdateCommand, and DeleteCommand properties. It assumes you have already created a SqlConnection object.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: