Name
OleDbCommand
Synopsis
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(stringcmdText
); public OleDbCommand(stringcmdText
, OleDbConnectionconnection
); public OleDbCommand(stringcmdText
, OleDbConnectionconnection
, OleDbTransactiontransaction
); // Public Instance Properties public string CommandText{set; get; } // implements System.Data.IDbCommand public int CommandTimeout{set; get; } // implements System.Data.IDbCommand public CommandType ...
Get ADO.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.