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)

public ref class OleDbParameterCollection sealed : public DbParameterCollection
public final class OleDbParameterCollection extends DbParameterCollection
public final class OleDbParameterCollection extends DbParameterCollection

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.

No code example is currently available or this language may not be supported.
using System;
using System.Data;
using System.Data.OleDb;

class Class1
    static void Main()
        //        string x = "Provider=SQLOLEDB;Data Source=(local);Integrated Security=SSPI;Initial Catalog=Northwind";

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

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

            // Open the connection and fill the DataSet.
            catch (Exception ex)
            // The connection is automatically closed when the
            // code exits the using block.
        return dataSet;


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

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions