[ Team LiB ] Previous Section Next Section

OleDbCommand marshal by reference, disposable

System.Data.OleDb (system.data.dll) sealed class

This class represents a SQL command that can be executed against a data source through the .NET OLE DB provider. For information about the basic OleDbCommand methods and properties, refer to the reference for the System.Data.IDbCommand interface, which OleDbCommand implements. OleDbCommand errors result in a OleDbException being thrown.

When CommandType is set to System.Data.CommandType.Text , named parameters aren't supported. This differs from the SQL Server provider. In this case, you must use a question mark (?) placeholder for parameters in the SQL statement. For example, you can set the CommandType to System.Data.CommandType.Text , and set the CommandText to:

SELECT * FROM Customers WHERE CustomerID = ?

to specify that a CustomerID value will be supplied as a parameter. If there is more than one parameter, the order in which you insert the OleDbParameter to the Parameters collection must match the order of the placeholders.

public sealed class OleDbCommand : System.ComponentModel.Component , ICloneable, System.Data.IDbCommand {
// Public Constructors
   public OleDbCommand(  );  
   public OleDbCommand( string cmdText);  
   public OleDbCommand(string cmdText, OleDbConnection connection);
   public OleDbCommand(string cmdText, OleDbConnection connection, OleDbTransaction transaction);
// Public Instance Properties
   public string CommandText{set; get; }                       // implements System.Data.IDbCommand
   public int CommandTimeout{set; get; }                       // implements System.Data.IDbCommand
   public CommandType CommandType{set; get; }                  // implements System.Data.IDbCommand
   public OleDbConnection Connection{set; get; } 
   public bool DesignTimeVisible{set; get; } 
   public OleDbParameterCollection Parameters{get; } 
   public OleDbTransaction Transaction{set; get; } 
   public UpdateRowSource UpdatedRowSource{set; get; }         // implements System.Data.IDbCommand
// Public Instance Methods
   public void Cancel(  );                                       // implements System.Data.IDbCommand
   public OleDbParameter CreateParameter(  );  
   public int ExecuteNonQuery(  );                               // implements System.Data.IDbCommand
   public OleDbDataReader ExecuteReader(  );  
   public OleDbDataReader ExecuteReader(System.Data.CommandBehavior behavior);
   public object ExecuteScalar(  );                              // implements System.Data.IDbCommand
   public void Prepare(  );                                      // implements System.Data.IDbCommand
   public void ResetCommandTimeout(  );  
// Protected Instance Methods
   protected override void Dispose( bool disposing);           // overrides System.ComponentModel.Component
}

Hierarchy

System.Object figs/U2192.gif System.MarshalByRefObject figs/U2192.gif System.ComponentModel.Component(System.ComponentModel.IComponent, System.IDisposable) figs/U2192.gif OleDbCommand(System.ICloneable, System.Data.IDbCommand)

Returned By

OleDbCommandBuilder.{GetDeleteCommand( ) , GetInsertCommand( ) , GetUpdateCommand( )} , OleDbConnection.CreateCommand( ) , OleDbDataAdapter.{DeleteCommand , InsertCommand , SelectCommand , UpdateCommand} , OleDbRowUpdatedEventArgs.Command , OleDbRowUpdatingEventArgs.Command

Passed To

OleDbCommandBuilder.DeriveParameters( ) , OleDbDataAdapter.{DeleteCommand , InsertCommand , OleDbDataAdapter( ) , SelectCommand , UpdateCommand} , OleDbRowUpdatingEventArgs.Command

    [ Team LiB ] Previous Section Next Section