OleDbParameterCollection Class

OleDbParameterCollection Class

 

Represents a collection of parameters relevant to an OleDbCommand as well as their respective mappings to columns in a DataSet.

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

System.Object
  System.MarshalByRefObject
    System.Data.Common.DbParameterCollection
      System.Data.OleDb.OleDbParameterCollection

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

NameDescription
System_CAPS_pubpropertyCount

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

System_CAPS_pubpropertyIsFixedSize

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

System_CAPS_pubpropertyIsReadOnly

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

System_CAPS_pubpropertyIsSynchronized

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

System_CAPS_pubpropertyItem[Int32]

Gets or sets the OleDbParameter at the specified index.

System_CAPS_pubpropertyItem[String]

Gets or sets the OleDbParameter with the specified name.

System_CAPS_pubpropertySyncRoot

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

NameDescription
System_CAPS_pubmethodAdd(Object)

Adds the specified OleDbParameter object to the OleDbParameterCollection.(Overrides DbParameterCollection.Add(Object).)

System_CAPS_pubmethodAdd(OleDbParameter)

Adds the specified OleDbParameter to the OleDbParameterCollection.

System_CAPS_pubmethodAdd(String, Object)

Obsolete.Adds an OleDbParameter to the OleDbParameterCollection given the parameter name and value.

System_CAPS_pubmethodAdd(String, OleDbType)

Adds an OleDbParameter to the OleDbParameterCollection, given the parameter name and data type.

System_CAPS_pubmethodAdd(String, OleDbType, Int32)

Adds an OleDbParameter to the OleDbParameterCollection given the parameter name, data type, and column length.

System_CAPS_pubmethodAdd(String, OleDbType, Int32, String)

Adds an OleDbParameter to the OleDbParameterCollection 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 OleDbParameterCollection.(Overrides DbParameterCollection.AddRange(Array).)

System_CAPS_pubmethodAddRange(OleDbParameter[])

Adds an array of OleDbParameter values to the end of the OleDbParameterCollection.

System_CAPS_pubmethodAddWithValue(String, Object)

Adds a value to the end of the OleDbParameterCollection.

System_CAPS_pubmethodClear()

Removes all OleDbParameter objects from the OleDbParameterCollection.(Overrides DbParameterCollection.Clear().)

System_CAPS_pubmethodContains(Object)

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

System_CAPS_pubmethodContains(OleDbParameter)

Determines whether the specified OleDbParameter is in this OleDbParameterCollection.

System_CAPS_pubmethodContains(String)

Determines whether the specified String is in this OleDbParameterCollection.(Overrides DbParameterCollection.Contains(String).)

System_CAPS_pubmethodCopyTo(Array, Int32)

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

System_CAPS_pubmethodCopyTo(OleDbParameter[], Int32)

Copies all the elements of the current OleDbParameterCollection to the specified OleDbParameterCollection 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 OleDbParameterCollection.(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)

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

System_CAPS_pubmethodIndexOf(OleDbParameter)

Gets the location of the specified OleDbParameter within the collection.

System_CAPS_pubmethodIndexOf(String)

Gets the location of the specified OleDbParameter 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 OleDbParameterCollection at the specified index.(Overrides DbParameterCollection.Insert(Int32, Object).)

System_CAPS_pubmethodInsert(Int32, OleDbParameter)

Inserts a OleDbParameter object into the OleDbParameterCollection at the specified index.

System_CAPS_pubmethodRemove(Object)

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

System_CAPS_pubmethodRemove(OleDbParameter)

Removes the OleDbParameter from the OleDbParameterCollection.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the OleDbParameter from the OleDbParameterCollection at the specified index.(Overrides DbParameterCollection.RemoveAt(Int32).)

System_CAPS_pubmethodRemoveAt(String)

Removes the OleDbParameter from the OleDbParameterCollection at 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, otherwise the .NET Framework Data Provider for OLE DB might raise an error.

The following example creates multiple instances of OleDbParameter through the OleDbParameterCollection collection within the OleDbDataAdapter. These parameters are used to select data within the data source and place the data in the DataSet. This example assumes that a DataSet and an OleDbDataAdapter have already been created with the appropriate schema, commands, and connection.

public DataSet GetDataSetFromAdapter(
    DataSet dataSet, string connectionString, string queryString)
{
    using (OleDbConnection connection =
               new OleDbConnection(connectionString))
    {
        OleDbDataAdapter adapter =
            new OleDbDataAdapter(queryString, connection);

        // Set the parameters.
        adapter.SelectCommand.Parameters.Add(
            "@CategoryName", OleDbType.VarChar, 80).Value = "toasters";
        adapter.SelectCommand.Parameters.Add(
            "@SerialNum", OleDbType.Integer).Value = 239;

        // Open the connection and fill the DataSet.
        try
        {
            connection.Open();
            adapter.Fill(dataSet);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        // The connection is automatically closed when the
        // code exits the using block.
    }
    return dataSet;
}

.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