asp.net.ph

OleDbCommand.ExecuteReader Method

System.Data.OleDb Namespace   OleDbCommand Class


Sends the CommandText to the Connection and builds an OleDbDataReader.

Overload List

1. Sends the CommandText to the Connection and builds an OleDbDataReader.

2. Sends the CommandText to the Connection, and builds an OleDbDataReader using one of the CommandBehavior values.


Example

The following example illustrates use of the ExecuteReader method.

NOTE: This example uses one of the overloaded versions of ExecuteReader. For other examples that may be available, see the individual overload topics.

void ExecuteReaderDemo ( string query, string connString ) {
   OleDbConnection myConn = new OleDbConnection ( connString );
   OleDbCommand myCommand = new OleDbCommand ( query, myConn );
   myCommand.Connection.Open ( );
   OleDbDataReader myReader = myCommand.ExecuteReader (
      CommandBehavior.CloseConnection );
   while ( myReader.Read ( ) ) {
      Response.Write ( myReader.GetString ( 0 ) );
   }
   myReader.Close ( );
   myConn.Close ( );
}
  C# VB

See Also

OleDbCommand Members 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