OleDbParameterCollection Class
.NET Framework 3.0
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)
Assembly: System.Data (in system.data.dll)
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; }
System.Object
System.MarshalByRefObject
System.Data.Common.DbParameterCollection
System.Data.OleDb.OleDbParameterCollection
System.MarshalByRefObject
System.Data.Common.DbParameterCollection
System.Data.OleDb.OleDbParameterCollection
Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: