DbDataAdapter.SelectCommand Property
.NET Framework 4
Gets or sets a command used to select records in the data source.
Assembly: System.Data (in System.Data.dll)
Property Value
Type: System.Data.Common.DbCommandA IDbCommand that is used during Update to select records from data source for placement in the data set.
The following example creates the derived class OleDbDataAdapter and sets some of its properties.
public static OleDbDataAdapter CreateCustomerAdapter( OleDbConnection connection) { OleDbDataAdapter adapter = new OleDbDataAdapter(); OleDbCommand command; // Create the SelectCommand. command = new OleDbCommand("SELECT * FROM Customers " + "WHERE Country = ? AND City = ?", connection); command.Parameters.Add("Country", OleDbType.VarChar, 15); command.Parameters.Add("City", OleDbType.VarChar, 15); adapter.SelectCommand = command; // Create the InsertCommand. command = new OleDbCommand( "INSERT INTO Customers (CustomerID, CompanyName) " + "VALUES (?, ?)", connection); command.Parameters.Add( "CustomerID", OleDbType.Char, 5, "CustomerID"); command.Parameters.Add( "CompanyName", OleDbType.VarChar, 40, "CompanyName"); adapter.InsertCommand = command; return adapter; }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.