共用方式為


ServerConnection.ExecuteReader Method

Definition

Overloads

ExecuteReader(String, SqlCommand)

Executes T-SQL statements. A SqlDataReader object is returned that can be used to read the stream of rows that are returned by SQL Server. A SqlCommand object is also returned that can be used to cancel the data reader pipe if an abort of a long-running query is needed. it doesn't automatically disconnect Exceptions: ConnectionFailureException ExecutionFailureExeception

ExecuteReader(String, SqlCommand)

Executes T-SQL statements. A SqlDataReader object is returned that can be used to read the stream of rows that are returned by SQL Server. A SqlCommand object is also returned that can be used to cancel the data reader pipe if an abort of a long-running query is needed. it doesn't automatically disconnect Exceptions: ConnectionFailureException ExecutionFailureExeception

ExecuteReader(String)

Executes T-SQL statements. A SqlDataReader object is returned that can be used to read the stream of rows that are returned by SQL Server. The Connect() method will be called if the connection with the server is not open. it doesn't automatically disconnect Exceptions: ConnectionFailureException ExecutionFailureExeception

ExecuteReader(String, SqlCommand)

Executes T-SQL statements. A SqlDataReader object is returned that can be used to read the stream of rows that are returned by SQL Server. A SqlCommand object is also returned that can be used to cancel the data reader pipe if an abort of a long-running query is needed. it doesn't automatically disconnect Exceptions: ConnectionFailureException ExecutionFailureExeception

public System.Data.SqlClient.SqlDataReader ExecuteReader (string sqlCommand, out System.Data.SqlClient.SqlCommand command);
member this.ExecuteReader : string * SqlCommand -> System.Data.SqlClient.SqlDataReader
Public Function ExecuteReader (sqlCommand As String, ByRef command As SqlCommand) As SqlDataReader

Parameters

sqlCommand
String

The SQL command text.

command
SqlCommand

The resulting SqlCommand object for data reader pipe cancellation.

Returns

The data reader.

Applies to

ExecuteReader(String, SqlCommand)

Executes T-SQL statements. A SqlDataReader object is returned that can be used to read the stream of rows that are returned by SQL Server. A SqlCommand object is also returned that can be used to cancel the data reader pipe if an abort of a long-running query is needed. it doesn't automatically disconnect Exceptions: ConnectionFailureException ExecutionFailureExeception

public Microsoft.Data.SqlClient.SqlDataReader ExecuteReader (string sqlCommand, out Microsoft.Data.SqlClient.SqlCommand command);
member this.ExecuteReader : string * SqlCommand -> Microsoft.Data.SqlClient.SqlDataReader
Public Function ExecuteReader (sqlCommand As String, ByRef command As SqlCommand) As SqlDataReader

Parameters

sqlCommand
String

The SQL command text.

command
SqlCommand

The resulting SqlCommand object for data reader pipe cancellation.

Returns

The data reader.

Applies to

ExecuteReader(String)

Executes T-SQL statements. A SqlDataReader object is returned that can be used to read the stream of rows that are returned by SQL Server. The Connect() method will be called if the connection with the server is not open. it doesn't automatically disconnect Exceptions: ConnectionFailureException ExecutionFailureExeception

public System.Data.SqlClient.SqlDataReader ExecuteReader (string sqlCommand);
public Microsoft.Data.SqlClient.SqlDataReader ExecuteReader (string sqlCommand);
member this.ExecuteReader : string -> System.Data.SqlClient.SqlDataReader
member this.ExecuteReader : string -> Microsoft.Data.SqlClient.SqlDataReader
Public Function ExecuteReader (sqlCommand As String) As SqlDataReader

Parameters

sqlCommand
String

The SQL command text.

Returns

The data reader.

Applies to