asp.net.ph

SqlDataAdapter.SelectCommand Property

System.Data.SqlClient Namespace   SqlDataAdapter Class


Sets or retrieves a command used to select records in the data source.

[ VB ]
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 );

Property Value

An SqlCommand used during Fill to select records from the data source for loading into the DataSet.

Remarks

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, but no exception is raised.

Example

The following example illustrates use of the SelectCommand property.

void SelectCommandDemo ( ) {
   SqlDataAdapter myAdapter = new SqlDataAdapter ( );
   myAdapter.SelectCommand.CommandText = "SELECT * FROM Categories ";
   myAdapter.SelectCommand.Connection = new SqlConnection
      ( "uid=sa; pwd=; database=northwind; server=myServer" );
}
  C# VB

See Also

SqlDataAdapter Members   DeleteCommand   InsertCommand   UpdateCommand Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph