This documentation is archived and is not being maintained.

OracleParameterCollection.Add Method (String, Object)

.NET Framework 1.1
Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Adds an OracleParameter to the OracleParameterCollection given the parameter name and value.

[Visual Basic]
Overloads Public Function Add( _
   ByVal parameterName As String, _
   ByVal value As Object _
) As OracleParameter
public OracleParameter Add(
 string parameterName,
 object value
public: OracleParameter* Add(
 String* parameterName,
 Object* value
public function Add(
   parameterName : String,
 value : Object
) : OracleParameter;


The name of the parameter.
The Value of the OracleParameter to add to the collection.

Return Value

The index of the new OracleParameter object.


Exception Type Condition
InvalidCastException The value parameter is not an OracleParameter.


Use caution when using this overload of the Add method to specify integer parameter values. Because this overload takes a value of type Object, you must convert the integral value to an Object type when the value is zero, as the following C# example demonstrates.

parameters.Add("pname", Convert.ToInt32(0));

If you do not perform this conversion, the compiler will assume you are attempting to call the OracleParameterCollection.Add (string, OracleType) overload.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

OracleParameterCollection Class | OracleParameterCollection Members | System.Data.OracleClient Namespace | OracleParameterCollection.Add Overload List