Export (0) Print
Expand All

DbCommand Class

Represents an SQL statement or stored procedure to execute against a data source. Provides a base class for database-specific classes that represent commands. ExecuteNonQueryAsync

Namespace:  System.Data.Common
Assembly:  System.Data (in System.Data.dll)

public abstract class DbCommand : Component, 
	IDbCommand, IDisposable

The DbCommand type exposes the following members.

  NameDescription
Protected methodSupported by the XNA FrameworkDbCommandConstructs an instance of the DbCommand object.
Top

  NameDescription
Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event. (Inherited from Component.)
Public propertySupported by the XNA FrameworkCommandTextGets or sets the text command to run against the data source.
Public propertySupported by the XNA FrameworkCommandTimeoutGets or sets the wait time before terminating the attempt to execute a command and generating an error.
Public propertySupported by the XNA FrameworkCommandTypeIndicates or specifies how the CommandText property is interpreted.
Public propertySupported by the XNA FrameworkConnectionGets or sets the DbConnection used by this DbCommand.
Public propertyContainerGets the IContainer that contains the Component. (Inherited from Component.)
Protected propertySupported by the XNA FrameworkDbConnectionGets or sets the DbConnection used by this DbCommand.
Protected propertySupported by the XNA FrameworkDbParameterCollectionGets the collection of DbParameter objects.
Protected propertySupported by the XNA FrameworkDbTransactionGets or sets the DbTransaction within which this DbCommand object executes.
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Public propertySupported by the XNA FrameworkDesignTimeVisibleGets or sets a value indicating whether the command object should be visible in a customized interface control.
Protected propertySupported by the XNA FrameworkEventsGets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public propertySupported by the XNA FrameworkParametersGets the collection of DbParameter objects. For more information on parameters, see Configuring Parameters and Parameter Data Types.
Public propertySupported by the XNA FrameworkSiteGets or sets the ISite of the Component. (Inherited from Component.)
Public propertySupported by the XNA FrameworkTransactionGets or sets the DbTransaction within which this DbCommand object executes.
Public propertySupported by the XNA FrameworkUpdatedRowSourceGets or sets how command results are applied to the DataRow when used by the Update method of a DbDataAdapter.
Top

  NameDescription
Public methodSupported by the XNA FrameworkCancelAttempts to cancels the execution of a DbCommand.
Protected methodSupported by the XNA FrameworkCreateDbParameterCreates a new instance of a DbParameter object.
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodSupported by the XNA FrameworkCreateParameterCreates a new instance of a DbParameter object.
Public methodSupported by the XNA FrameworkDispose()Releases all resources used by the Component. (Inherited from Component.)
Protected methodSupported by the XNA FrameworkDispose(Boolean)Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Inherited from Component.)
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkExecuteDbDataReaderExecutes the command text against the connection.
Protected methodExecuteDbDataReaderAsyncProviders should implement this method to provide a non-default implementation for ExecuteReader overloads.The default implementation invokes the synchronous ExecuteReader method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by ExecuteReader will be communicated via the returned Task Exception property.This method accepts a cancellation token that can be used to request the operation to be cancelled early. Implementations may ignore this request.
Public methodSupported by the XNA FrameworkExecuteNonQueryExecutes a SQL statement against a connection object.
Public methodExecuteNonQueryAsync()An asynchronous version of ExecuteNonQuery, which executes a SQL statement against a connection object.Invokes ExecuteNonQueryAsync with CancellationToken.None.
Public methodExecuteNonQueryAsync(CancellationToken)This is the asynchronous version of ExecuteNonQuery. Providers should override with an appropriate implementation. The cancellation token may optionally be ignored.The default implementation invokes the synchronous ExecuteNonQuery method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by ExecuteNonQuery will be communicated via the returned Task Exception property.Do not invoke other methods and properties of the DbCommand object until the returned Task is complete.
Public methodSupported by the XNA FrameworkExecuteReader()Executes the CommandText against the Connection, and returns an DbDataReader.
Public methodSupported by the XNA FrameworkExecuteReader(CommandBehavior)Executes the CommandText against the Connection, and returns an DbDataReader using one of the CommandBehavior values.
Public methodExecuteReaderAsync()An asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader.Invokes ExecuteDbDataReaderAsync with CancellationToken.None.
Public methodExecuteReaderAsync(CancellationToken)An asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader. This method propagates a notification that operations should be canceled.Invokes ExecuteDbDataReaderAsync.
Public methodExecuteReaderAsync(CommandBehavior)An asynchronous version of ExecuteReader, which executes the CommandText against the Connection and returns a DbDataReader.Invokes ExecuteDbDataReaderAsync.
Public methodExecuteReaderAsync(CommandBehavior, CancellationToken)Invokes ExecuteDbDataReaderAsync.
Public methodSupported by the XNA FrameworkExecuteScalarExecutes the query and returns the first column of the first row in the result set returned by the query. All other columns and rows are ignored.
Public methodExecuteScalarAsync()An asynchronous version of ExecuteScalar, which executes the query and returns the first column of the first row in the result set returned by the query. All other columns and rows are ignored.Invokes ExecuteScalarAsync with CancellationToken.None.
Public methodExecuteScalarAsync(CancellationToken)This is the asynchronous version of ExecuteScalar. Providers should override with an appropriate implementation. The cancellation token may optionally be ignored.The default implementation invokes the synchronous ExecuteScalar method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by ExecuteScalar will be communicated via the returned Task Exception property.Do not invoke other methods and properties of the DbCommand object until the returned Task is complete.
Protected methodSupported by the XNA FrameworkFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
Public methodSupported by the XNA FrameworkGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodSupported by the XNA FrameworkMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public methodSupported by the XNA FrameworkPrepareCreates a prepared (or compiled) version of the command on the data source.
Public methodSupported by the XNA FrameworkToStringReturns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.)

In XNA Framework 3.0, this member is inherited from Object.ToString().
Top

  NameDescription
Public eventSupported by the XNA FrameworkDisposedOccurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Top

  NameDescription
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIDbCommand.ConnectionGets or sets the IDbConnection used by this instance of the IDbCommand.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDbCommand.CreateParameterCreates a new instance of an IDbDataParameter object.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDbCommand.ExecuteReader()Executes the CommandText against the Connection and builds an IDataReader.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDbCommand.ExecuteReader(CommandBehavior)Executes the CommandText against the Connection, and builds an IDataReader using one of the CommandBehavior values.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIDbCommand.ParametersGets the IDataParameterCollection.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIDbCommand.TransactionGets or sets the DbTransaction within which this DbCommand object executes.
Top

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft