(I)DbCommand
hierarchy
System.Data.IDbCommand
System.Data.Common.DbCommand
- System.Data.EntityClient.EntityCommand
- System.Data.Odbc.OdbcCommand
- System.Data.OleDb.OleDbCommand
- System.Data.OracleClient.OracleCommand
- System.Data.SqlClient.SqlCommand
methods
- Executes a Transact-SQL statement against the connection and returns the number of rows affected. Perform catalog operations (for example, querying the structure of a database or creating database objects such as tables), or to change the data in a database without using a DataSet by executing UPDATE, INSERT, or DELETE statements.
ExecuteNonQuery BeginExecuteNonQuery EndExecuteNonQuery BeginExecuteNonQueryAsync
- Sends the
CommandText
to theConnection
and builds aSqlDataReader
.
Executes commands that return rows. For increased performance, ExecuteReader invokes commands using the Transact-SQLsp_executesql
system stored procedure. Therefore, ExecuteReader might not have the effect that you want if used to execute commands such as Transact-SQL SET statementsExecuteReader BeginExecuteReader EndExecuteReader(IAsyncResult) ExecuteReaderAsync
- Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored. Retrieves a single value (for example, an aggregate value) from a database.
ExecuteScalar ExecuteScalarAsync() [Begin|End]ExecuteScalar
- Sends the CommandText to the Connection and builds an
XmlReader
object. UseSqlDbType.Xml
for parameters.
ExecuteXmlReader
BeginExecuteXmlReader
EndExecuteXmlReader
ExecuteXmlReaderAsync()
- ADO.NET 2 also provides true asynchronous operations. Unlike creating a background thread and blocking, ADO.NET 2 implements asynchronous operations by using ~IO Completion ports~, which are built into the .NET Framework but are truly asynchronous, with no secondary thread being created and blocked while the UI continues on. The ADO.NET 2 solution follows the general look-and-feel for the other asynchronous commands within the .NET Framework, as the method names use the standard calling syntax of BeginABC/EndABC. The
SqlCommand
class provides support for asynchronous commands through the following methods:
BeginExecuteNonQuery/EndExecuteNonQuery
BeginExecuteReader/EndExecuteReader
BeginExecuteXmlReader/EndExecuteXmlReader