(I)DbCommand

hierarchy

methods

  1. 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
    
  2. Sends the CommandText to the Connection and builds a SqlDataReader.
    Executes commands that return rows. For increased performance, ExecuteReader invokes commands using the Transact-SQL sp_executesql system stored procedure. Therefore, ExecuteReader might not have the effect that you want if used to execute commands such as Transact-SQL SET statements
    ExecuteReader
    BeginExecuteReader
    EndExecuteReader(IAsyncResult)
    ExecuteReaderAsync
    
  3. 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
    
  4. Sends the CommandText to the Connection and builds an XmlReader object. Use SqlDbType.Xml for parameters.
ExecuteXmlReader  
BeginExecuteXmlReader  
EndExecuteXmlReader  
ExecuteXmlReaderAsync()
  1. 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