OdbcParameterCollection Class

OdbcParameterCollection Class

 

Represents a collection of parameters relevant to an OdbcCommand and their respective mappings to columns in a DataSet. This class cannot be inherited.

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

System.Object
  System.MarshalByRefObject
    System.Data.Common.DbParameterCollection
      System.Data.Odbc.OdbcParameterCollection

[ListBindableAttribute(false)]
public sealed class OdbcParameterCollection : DbParameterCollection

NameDescription
System_CAPS_pubpropertyCount

Returns an Integer that contains the number of elements in the OdbcParameterCollection. Read-only.(Overrides DbParameterCollection.Count.)

System_CAPS_pubpropertyIsFixedSize

Gets a value that indicates whether the OdbcParameterCollection has a fixed size. Read-only.(Overrides DbParameterCollection.IsFixedSize.)

System_CAPS_pubpropertyIsReadOnly

Gets a value that indicates whether the OdbcParameterCollection is read-only.(Overrides DbParameterCollection.IsReadOnly.)

System_CAPS_pubpropertyIsSynchronized

Gets a value that indicates whether the OdbcParameterCollection is synchronized. Read-only.(Overrides DbParameterCollection.IsSynchronized.)

System_CAPS_pubpropertyItem[Int32]

Gets or sets the OdbcParameter at the specified index.

System_CAPS_pubpropertyItem[String]

Gets or sets the OdbcParameter with the specified name.

System_CAPS_pubpropertySyncRoot

Gets an object that can be used to synchronize access to the OdbcParameterCollection. Read-only.(Overrides DbParameterCollection.SyncRoot.)

NameDescription
System_CAPS_pubmethodAdd(Object)

Adds the specified OdbcParameter object to the OdbcParameterCollection.(Overrides DbParameterCollection.Add(Object).)

System_CAPS_pubmethodAdd(OdbcParameter)

Adds the specified OdbcParameter to the OdbcParameterCollection.

System_CAPS_pubmethodAdd(String, Object)

Obsolete.Adds an OdbcParameter to the OdbcParameterCollection given the parameter name and value.

System_CAPS_pubmethodAdd(String, OdbcType)

Adds an OdbcParameter to the OdbcParameterCollection, given the parameter name and data type.

System_CAPS_pubmethodAdd(String, OdbcType, Int32)

Adds an OdbcParameter to the OdbcParameterCollection, given the parameter name, data type, and column length.

System_CAPS_pubmethodAdd(String, OdbcType, Int32, String)

Adds an OdbcParameter to the OdbcParameterCollection given the parameter name, data type, column length, and source column name.

System_CAPS_pubmethodAddRange(Array)

Adds an array of values to the end of the OdbcParameterCollection.(Overrides DbParameterCollection.AddRange(Array).)

System_CAPS_pubmethodAddRange(OdbcParameter[])

Adds an array of OdbcParameter values to the end of the OdbcParameterCollection.

System_CAPS_pubmethodAddWithValue(String, Object)

Adds a value to the end of the OdbcParameterCollection.

System_CAPS_pubmethodClear()

Removes all OdbcParameter objects from the OdbcParameterCollection.(Overrides DbParameterCollection.Clear().)

System_CAPS_pubmethodContains(Object)

Determines whether the specified Object is in this OdbcParameterCollection.(Overrides DbParameterCollection.Contains(Object).)

System_CAPS_pubmethodContains(OdbcParameter)

Determines whether the specified OdbcParameter is in this OdbcParameterCollection.

System_CAPS_pubmethodContains(String)

Gets a value indicating whether an OdbcParameter object with the specified parameter name exists in the collection.(Overrides DbParameterCollection.Contains(String).)

System_CAPS_pubmethodCopyTo(Array, Int32)

Copies all the elements of the current OdbcParameterCollection to the specified one-dimensional Array starting at the specified destination Array index.(Overrides DbParameterCollection.CopyTo(Array, Int32).)

System_CAPS_pubmethodCopyTo(OdbcParameter[], Int32)

Copies all the elements of the current OdbcParameterCollection to the specified OdbcParameterCollection starting at the specified destination index.

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Returns an enumerator that iterates through the OdbcParameterCollection.(Overrides DbParameterCollection.GetEnumerator().)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodIndexOf(Object)

Gets the location of the specified Object within the collection.(Overrides DbParameterCollection.IndexOf(Object).)

System_CAPS_pubmethodIndexOf(OdbcParameter)

Gets the location of the specified OdbcParameter within the collection.

System_CAPS_pubmethodIndexOf(String)

Gets the location of the specified OdbcParameter with the specified name.(Overrides DbParameterCollection.IndexOf(String).)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodInsert(Int32, Object)

Inserts a Object into the OdbcParameterCollection at the specified index.(Overrides DbParameterCollection.Insert(Int32, Object).)

System_CAPS_pubmethodInsert(Int32, OdbcParameter)

Inserts a OdbcParameter object into the OdbcParameterCollection at the specified index.

System_CAPS_pubmethodRemove(Object)

Removes the Object object from the OdbcParameterCollection.(Overrides DbParameterCollection.Remove(Object).)

System_CAPS_pubmethodRemove(OdbcParameter)

Removes the OdbcParameter from the OdbcParameterCollection.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the OdbcParameter from the OdbcParameterCollection at the specified index.(Overrides DbParameterCollection.RemoveAt(Int32).)

System_CAPS_pubmethodRemoveAt(String)

Removes the OdbcParameter from the OdbcParameterCollection with the specified parameter name.(Overrides DbParameterCollection.RemoveAt(String).)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList.Item[Int32]

Gets or sets the element at the specified index.(Inherited from DbParameterCollection.)

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIDataParameterCollection.Item[String]

Gets or sets the parameter at the specified index.(Inherited from DbParameterCollection.)

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

The number of parameters in the collection must equal the number of parameter placeholders within the command text, or else the .NET Framework Data Provider for ODBC raises an error.

The following example assumes that the data source has a table named MoneyTable and a stored procedure named MoneyProcedure, which are defined as follows:

CREATE TABLE MoneyTable (col1 int, col2 smallmoney, col3 decimal);

CREATE PROC MoneyProcedure (@p1 int, @p2 smallmoney, @p3 decimal) 
AS 
INSERT INTO MyTable VALUES (@p1, @p2, @p3);

The example creates parameters and calls the MoneyProcedure stored procedure.

public void CreateMyProc(OdbcConnection connection)
{
    OdbcCommand command = connection.CreateCommand();
    command.CommandText = "{ call MyProc(?,?,?) }";

    OdbcParameter param = new OdbcParameter();
    param.DbType = DbType.Int32;
    param.Value = 1;
    command.Parameters.Add(param);

    param = new OdbcParameter();
    param.DbType = DbType.Decimal;
    param.Value = 1;
    command.Parameters.Add(param);

    param = new OdbcParameter();
    param.DbType = DbType.Decimal;
    param.Value = 1;
    command.Parameters.Add(param);

    command.ExecuteNonQuery();

 }

.NET Framework
Available since 1.1

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

Return to top
Show:
© 2016 Microsoft