OleDbParameterCollection Class
Represents a collection of parameters relevant to an OleDbCommand as well as their respective mappings to columns in a DataSet.
For a list of all members of this type, see OleDbParameterCollection Members.
System.Object
System.MarshalByRefObject
System.Data.OleDb.OleDbParameterCollection
[Visual Basic] NotInheritable Public Class OleDbParameterCollection Inherits MarshalByRefObject Implements IDataParameterCollection, IList, ICollection, _ IEnumerable [C#] public sealed class OleDbParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable [C++] public __gc __sealed class OleDbParameterCollection : public MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable [JScript] public class OleDbParameterCollection extends MarshalByRefObject implements IDataParameterCollection, IList, ICollection, IEnumerable
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
The number of parameters in the collection must be equal to the number of parameter placeholders within the command text, or the .NET Framework Data Provider for OLE DB may raise an error.
Example
[Visual Basic, C#, C++] 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.
[Visual Basic] Public Sub AddOleDbParameters() ' ... ' create myDataSet and myDataAdapter ' ... myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", OleDbType.VarChar, 80).Value = "toasters" myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", OleDbType.Integer).Value = 239 myDataAdapter.Fill(myDataSet) End Sub 'AddOleDbParameters [C#] public void AddOleDbParameters() { // ... // create myDataSet and myDataAdapter // ... myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", OleDbType.VarChar, 80).Value = "toasters"; myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", OleDbType.Integer).Value = 239; myDataAdapter.Fill(myDataSet); } [C++] public: void AddOleDbParameters() { // ... // create myDataSet and myDataAdapter // ... myDataAdapter->SelectCommand->Parameters->Add(S"@CategoryName", OleDbType::VarChar, 80)->Value = S"toasters"; myDataAdapter->SelectCommand->Parameters->Add(S"@SerialNum", OleDbType::Integer)->Value = __box(239); myDataAdapter->Fill(myDataSet); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Data.OleDb
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Data (in System.Data.dll)
See Also
OleDbParameterCollection Members | System.Data.OleDb Namespace