OleDbParameterCollection Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a collection of parameters relevant to an OleDbCommand as well as their respective mappings to columns in a DataSet.
public ref class OleDbParameterCollection sealed : System::Data::Common::DbParameterCollection
public ref class OleDbParameterCollection sealed : MarshalByRefObject, System::Collections::IList, System::Data::IDataParameterCollection
public sealed class OleDbParameterCollection : System.Data.Common.DbParameterCollection
[System.ComponentModel.ListBindable(false)]
public sealed class OleDbParameterCollection : MarshalByRefObject, System.Collections.IList, System.Data.IDataParameterCollection
[System.ComponentModel.ListBindable(false)]
public sealed class OleDbParameterCollection : System.Data.Common.DbParameterCollection
type OleDbParameterCollection = class
inherit DbParameterCollection
[<System.ComponentModel.ListBindable(false)>]
type OleDbParameterCollection = class
inherit MarshalByRefObject
interface IDataParameterCollection
interface IList
interface ICollection
interface IEnumerable
[<System.ComponentModel.ListBindable(false)>]
type OleDbParameterCollection = class
inherit DbParameterCollection
Public NotInheritable Class OleDbParameterCollection
Inherits DbParameterCollection
Public NotInheritable Class OleDbParameterCollection
Inherits MarshalByRefObject
Implements IDataParameterCollection, IList
- Inheritance
- Inheritance
- Inheritance
- Attributes
- Implements
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;
}
Public Function GetDataSetFromAdapter( _
ByVal dataSet As DataSet, ByVal connectionString As String, _
ByVal queryString As String) As DataSet
Using connection As New OleDbConnection(connectionString)
Dim adapter As 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 ex As Exception
Console.WriteLine(ex.Message)
End Try
' The connection is automatically closed when the
' code exits the Using block.
End Using
Return dataSet
End Function
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.
Count |
Returns an integer that contains the number of elements in the OleDbParameterCollection. Read-only. |
Is |
Gets a value that indicates whether the OleDbParameterCollection has a fixed size. Read-only. |
Is |
Gets a value that indicates whether the OleDbParameterCollection is read-only. |
Is |
Gets a value that indicates whether the OleDbParameterCollection is synchronized. Read-only. |
Item[Int32] |
Gets or sets the OleDbParameter at the specified index. |
Item[String] |
Gets or sets the OleDbParameter with the specified name. |
Sync |
Gets an object that can be used to synchronize access to the OleDbParameterCollection. Read-only. |
Add(Object) |
Adds the specified OleDbParameter object to the OleDbParameterCollection. |
Add(Ole |
Adds the specified OleDbParameter to the OleDbParameterCollection. |
Add(String, Object) |
Obsolete.
Obsolete.
Adds an OleDbParameter to the OleDbParameterCollection given the parameter name and value. |
Add(String, Ole |
Adds an OleDbParameter to the OleDbParameterCollection given the parameter name, data type, column length, and source column name. |
Add(String, Ole |
Adds an OleDbParameter to the OleDbParameterCollection given the parameter name, data type, and column length. |
Add(String, Ole |
Adds an OleDbParameter to the OleDbParameterCollection, given the parameter name and data type. |
Add |
Adds an array of values to the end of the OleDbParameterCollection. |
Add |
Adds an array of OleDbParameter values to the end of the OleDbParameterCollection. |
Add |
Adds a value to the end of the OleDbParameterCollection. |
Clear() |
Removes all OleDbParameter objects from the OleDbParameterCollection. |
Contains(Object) |
Determines whether the specified Object is in this OleDbParameterCollection. |
Contains(Ole |
Determines whether the specified OleDbParameter is in this OleDbParameterCollection. |
Contains(String) |
Determines whether the specified String is in this OleDbParameterCollection. |
Copy |
Copies all the elements of the current OleDbParameterCollection to the specified one-dimensional Array starting at the specified destination Array index. |
Copy |
Copies all the elements of the current OleDbParameterCollection to the specified OleDbParameterCollection starting at the specified destination index. |
Create |
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject) |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Returns an enumerator that iterates through the OleDbParameterCollection. |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Obsolete.
Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject) |
Get |
Returns the DbParameter object at the specified index in the collection. (Inherited from DbParameterCollection) |
Get |
Returns DbParameter the object with the specified name. (Inherited from DbParameterCollection) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Index |
The location of the specified Object within the collection. |
Index |
Gets the location of the specified OleDbParameter within the collection. |
Index |
Gets the location of the specified OleDbParameter with the specified name. |
Initialize |
Obsolete.
Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject) |
Insert(Int32, Object) |
Inserts a Object into the OleDbParameterCollection at the specified index. |
Insert(Int32, Ole |
Inserts a OleDbParameter object into the OleDbParameterCollection at the specified index. |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject) |
Remove(Object) |
Removes the Object object from the OleDbParameterCollection. |
Remove(Ole |
Removes the OleDbParameter from the OleDbParameterCollection. |
Remove |
Removes the OleDbParameter from the OleDbParameterCollection at the specified index. |
Remove |
Removes the OleDbParameter from the OleDbParameterCollection at the specified parameter name. |
Set |
Sets the DbParameter object at the specified index to a new value. (Inherited from DbParameterCollection) |
Set |
Sets the DbParameter object with the specified name to a new value. (Inherited from DbParameterCollection) |
To |
Returns a string that represents the current object. (Inherited from Object) |
IData |
Gets or sets the parameter at the specified index. (Inherited from DbParameterCollection) |
IList. |
Gets or sets the element at the specified index. (Inherited from DbParameterCollection) |
Cast<TResult>(IEnumerable) |
Casts the elements of an IEnumerable to the specified type. |
Of |
Filters the elements of an IEnumerable based on a specified type. |
As |
Enables parallelization of a query. |
As |
Converts an IEnumerable to an IQueryable. |
מוצר | גירסאות |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
משוב של .NET
.NET הוא פרויקט קוד פתוח. בחר קישור כדי לספק משוב: