<PackageReference Include="System.Data.SqlClient" Version="4.7.0-preview8.19405.3" />

SqlCommand

public sealed class SqlCommand : DbCommand, ICloneable
Represents a Transact-SQL statement or stored procedure to execute against a SQL Server database. This class cannot be inherited.
public SqlConnection Connection { get; set; }

Gets or sets the SqlConnection used by this instance of the SqlCommand.

public SqlNotificationRequest Notification { get; set; }

Gets the SqlParameterCollection.

public SqlTransaction Transaction { get; set; }

Gets or sets the SqlTransaction within which the SqlCommand executes.

Occurs when the execution of a Transact-SQL statement completes.

public SqlCommand()

Initializes a new instance of the SqlCommand class.

public SqlCommand(string cmdText)

Initializes a new instance of the SqlCommand class with the text of the query.

public SqlCommand(string cmdText, SqlConnection connection)

Initializes a new instance of the SqlCommand class with the text of the query and a SqlConnection.

public SqlCommand(string cmdText, SqlConnection connection, SqlTransaction transaction)

Initializes a new instance of the SqlCommand class with the text of the query, a SqlConnection, and the SqlTransaction.

public IAsyncResult BeginExecuteNonQuery(AsyncCallback callback, object stateObject)

public IAsyncResult BeginExecuteReader(AsyncCallback callback, object stateObject)

public IAsyncResult BeginExecuteReader(AsyncCallback callback, object stateObject, CommandBehavior behavior)

public IAsyncResult BeginExecuteXmlReader(AsyncCallback callback, object stateObject)

public SqlCommand Clone()

Creates a new SqlCommand object that is a copy of the current instance.

Creates a new instance of a SqlParameter object.

public int EndExecuteNonQuery(IAsyncResult asyncResult)

Sends the CommandText to the Connection and builds a SqlDataReader.

Sends the CommandText to the Connection, and builds a SqlDataReader using one of the CommandBehavior values.

An asynchronous version of ExecuteReader, which sends the CommandText to the Connection and builds a SqlDataReader. Exceptions will be reported via the returned Task object.

An asynchronous version of ExecuteReader, which sends the CommandText to the Connection, and builds a SqlDataReader. Exceptions will be reported via the returned Task object.

An asynchronous version of ExecuteReader, which sends the CommandText to the Connection, and builds a SqlDataReader The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. Exceptions will be reported via the returned Task object.

An asynchronous version of ExecuteReader, which sends the CommandText to the Connection and builds a SqlDataReader. The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. Exceptions will be reported via the returned Task object.

Sends the CommandText to the Connection and builds an XmlReader object.

An asynchronous version of ExecuteXmlReader, which sends the CommandText to the Connection and builds an XmlReader object. Exceptions will be reported via the returned Task object.

An asynchronous version of ExecuteXmlReader, which sends the CommandText to the Connection and builds an XmlReader object. The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. Exceptions will be reported via the returned Task object.

public void ResetCommandTimeout()