Command. Execute Reader Method
public: System::Data::IDataReader ^ ExecuteReader();
public System.Data.IDataReader ExecuteReader ();
abstract member ExecuteReader : unit -> System.Data.IDataReader
Public Function ExecuteReader () As IDataReader
public: System::Data::IDataReader ^ ExecuteReader(System::Data::CommandBehavior behavior);
public System.Data.IDataReader ExecuteReader (System.Data.CommandBehavior behavior);
abstract member ExecuteReader : System.Data.CommandBehavior -> System.Data.IDataReader
Public Function ExecuteReader (behavior As CommandBehavior) As IDataReader
When the CommandType property is set to
StoredProcedure, the CommandText property should be set to the name of the stored procedure. The command executes this stored procedure when you call ExecuteReader.
While the IDataReader is in use, the associated IDbConnection is busy serving the IDataReader. While in this state, no other operations can be performed on the IDbConnection other than closing it. This is the case until the Close method of the DataReader is called. If the DataReader is created with CommandBehavior set to
CloseConnection, closing the DataReader closes the connection automatically.