IDbCommand.ExecuteReader Método

Definição

Executa o CommandText no Connection e compila um IDataReader.Executes the CommandText against the Connection and builds an IDataReader.

Sobrecargas

ExecuteReader()

Executa o CommandText no Connection e compila um IDataReader.Executes the CommandText against the Connection and builds an IDataReader.

ExecuteReader(CommandBehavior)

Executa o CommandText para o Connection e cria um IDataReader usando um dos valores de CommandBehavior.Executes the CommandText against the Connection, and builds an IDataReader using one of the CommandBehavior values.

ExecuteReader()

Executa o CommandText no Connection e compila um IDataReader.Executes the CommandText against the Connection and builds an IDataReader.

public:
 System::Data::IDataReader ^ ExecuteReader();
public System.Data.IDataReader ExecuteReader ();
abstract member ExecuteReader : unit -> System.Data.IDataReader
Public Function ExecuteReader () As IDataReader

Retornos

IDataReader

Um objeto IDataReader.An IDataReader object.

Aplica-se a

ExecuteReader(CommandBehavior)

Executa o CommandText para o Connection e cria um IDataReader usando um dos valores de CommandBehavior.Executes the CommandText against the Connection, and builds an IDataReader using one of the CommandBehavior values.

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

Parâmetros

behavior
CommandBehavior

Um dos valores de CommandBehavior.One of the CommandBehavior values.

Retornos

IDataReader

Um objeto IDataReader.An IDataReader object.

Comentários

O chamador deve chamar o Open método da Connection propriedade.The caller must call the Open method of the Connection property.

Quando a CommandType propriedade é definida como StoredProcedure , a CommandText propriedade deve ser definida como o nome do procedimento armazenado.When the CommandType property is set to StoredProcedure, the CommandText property should be set to the name of the stored procedure. O comando executa esse procedimento armazenado quando você chama ExecuteReader .The command executes this stored procedure when you call ExecuteReader.

Observação

Use SequentialAccess para recuperar valores grandes e dados binários.Use SequentialAccess to retrieve large values and binary data. Caso contrário, um OutOfMemoryException pode ocorrer e a conexão será fechada.Otherwise, an OutOfMemoryException might occur and the connection will be closed.

Enquanto o IDataReader estiver em uso, o associado IDbConnection estará ocupado servindo o IDataReader .While the IDataReader is in use, the associated IDbConnection is busy serving the IDataReader. Enquanto estiver nesse estado, nenhuma outra operação poderá ser executada no IDbConnection diferente de fechá-la.While in this state, no other operations can be performed on the IDbConnection other than closing it. Esse é o caso até que o Close método do DataReader seja chamado.This is the case until the Close method of the DataReader is called. Se o DataReader for criado com CommandBehavior set como CloseConnection , fechar o DataReader fechará a conexão automaticamente.If the DataReader is created with CommandBehavior set to CloseConnection, closing the DataReader closes the connection automatically.

Aplica-se a