BindByName

This property specifies whether the binding method used for the parameter collection is by name or by position on a particular OracleConnection object.

Declaration

// C#
public bool BindByName { get; set;}

Property Type

System.Boolean

Property Value

Returns true if the parameters are bound by name; returns false if the parameters are bound by position.

Exceptions

System.ObjectDisposedException - This property cannot be accessed after the OracleConnection object is already disposed.

Remarks

The default value is false.

BindByName is ignored under the following conditions:

  • The value of the XmlCommandType property is Insert, Update, or Delete.

  • The value of the XmlCommandType property is Query, but there are no parameters set on the OracleCommand.

If the OracleCommand XmlCommandType property is OracleXmlCommandType.Query and any parameters are set on the OracleCommand, then its BindByName property must be set to true. Otherwise, the following OracleCommand methods throw an InvalidOperationException.

  • ExecuteNonQuery

  • ExecuteXmlReader

  • ExecuteStream

  • ExecuteToStream

The BindByName property can be configured on OracleCommand, OracleConnection , and OracleConfiguration objects. By default, OracleConnection BindByName property value inherits OracleConfiguration BindByName property value at construction time; OracleCommand BindByName property value inherits OracleConnection BindByName property value at construction time. The value of OracleCommand BindByName will be used to determine the binding method during command execution.