MySQL Connector/Net
MySqlParameterCollection Class |
Represents a collection of parameters relevant to a MySqlCommand as well as their respective mappings to columns in a DataSet. This class cannot be inherited.

SystemObject SystemMarshalByRefObject
System.Data.CommonDbParameterCollection
MySql.Data.MySqlClientMySqlParameterCollection
System.Data.CommonDbParameterCollection
MySql.Data.MySqlClientMySqlParameterCollection
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll) Version: 6.9.9

public sealed class MySqlParameterCollection : DbParameterCollection
Public NotInheritable Class MySqlParameterCollection Inherits DbParameterCollection
public ref class MySqlParameterCollection sealed : public DbParameterCollection
[<SealedAttribute>] type MySqlParameterCollection = class inherit DbParameterCollection end
The MySqlParameterCollection type exposes the following members.

Name | Description | |
---|---|---|
![]() | Count |
Gets the number of MySqlParameter objects in the collection.
(Overrides DbParameterCollectionCount.) |
![]() | IsFixedSize |
Gets a value that indicates whether the MySqlParameterCollection
has a fixed size.
(Overrides DbParameterCollectionIsFixedSize.) |
![]() | IsReadOnly |
Gets a value that indicates whether the MySqlParameterCollection
is read-only.
(Overrides DbParameterCollectionIsReadOnly.) |
![]() | IsSynchronized |
Gets a value that indicates whether the MySqlParameterCollection
is synchronized.
(Overrides DbParameterCollectionIsSynchronized.) |
![]() | ItemInt32 |
Gets the MySqlParameter at the specified index.
|
![]() | ItemString |
Gets the MySqlParameter with the specified name.
|
![]() | SyncRoot |
Gets an object that can be used to synchronize access to the
MySqlParameterCollection.
(Overrides DbParameterCollectionSyncRoot.) |

Name | Description | |
---|---|---|
![]() | Add(Object) |
Adds the specified MySqlParameter object to the MySqlParameterCollection.
(Overrides DbParameterCollectionAdd(Object).) |
![]() | Add(MySqlParameter) |
Adds the specified MySqlParameter object to the MySqlParameterCollection.
|
![]() | Add(String, MySqlDbType) |
Adds a MySqlParameter to the MySqlParameterCollection given the parameter name and the data type.
|
![]() | Add(String, Object) | Obsolete.
Adds a MySqlParameter to the MySqlParameterCollection given the specified parameter name and value.
|
![]() | Add(String, MySqlDbType, Int32) |
Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, and the column length.
|
![]() | Add(String, MySqlDbType, Int32, String) |
Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, the column length, and the source column name.
|
![]() | AddRange |
Adds an array of values to the end of the MySqlParameterCollection.
(Overrides DbParameterCollectionAddRange(Array).) |
![]() | AddWithValue | |
![]() | Clear |
Removes all items from the collection.
(Overrides DbParameterCollectionClear.) |
![]() | Contains(Object) |
Gets a value indicating whether a MySqlParameter exists in the collection.
(Overrides DbParameterCollectionContains(Object).) |
![]() | Contains(String) |
Gets a value indicating whether a MySqlParameter with the specified parameter name exists in the collection.
(Overrides DbParameterCollectionContains(String).) |
![]() | CopyTo |
Copies MySqlParameter objects from the MySqlParameterCollection to the specified array.
(Overrides DbParameterCollectionCopyTo(Array, Int32).) |
![]() | CreateObjRef | 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 | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetEnumerator |
Returns an enumerator that iterates through the MySqlParameterCollection.
(Overrides DbParameterCollectionGetEnumerator.) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetParameter(Int32) | (Overrides DbParameterCollectionGetParameter(Int32).) |
![]() | GetParameter(String) |
Retrieve the parameter with the given name.
(Overrides DbParameterCollectionGetParameter(String).) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | IndexOf(Object) |
Gets the location of a MySqlParameter in the collection.
(Overrides DbParameterCollectionIndexOf(Object).) |
![]() | IndexOf(String) |
Gets the location of the MySqlParameter in the collection with a specific parameter name.
(Overrides DbParameterCollectionIndexOf(String).) |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | Insert |
Inserts a MySqlParameter into the collection at the specified index.
(Overrides DbParameterCollectionInsert(Int32, Object).) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() | Remove |
Removes the specified MySqlParameter from the collection.
(Overrides DbParameterCollectionRemove(Object).) |
![]() | RemoveAt(Int32) |
Removes the specified MySqlParameter from the collection using a specific index.
(Overrides DbParameterCollectionRemoveAt(Int32).) |
![]() | RemoveAt(String) |
Removes the specified MySqlParameter from the collection using the parameter name.
(Overrides DbParameterCollectionRemoveAt(String).) |
![]() | SetParameter(Int32, DbParameter) | (Overrides DbParameterCollectionSetParameter(Int32, DbParameter).) |
![]() | SetParameter(String, DbParameter) | (Overrides DbParameterCollectionSetParameter(String, DbParameter).) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |

The number of the parameters in the collection must be equal to the number of
parameter placeholders within the command text, or an exception will be generated.

The following example creates multiple instances of MySqlParameter
through the MySqlParameterCollection collection within the MySqlDataAdapter.
These parameters are used to select data within the data source and place the data in
the DataSet. This code assumes that a DataSet and a MySqlDataAdapter
have already been created with the appropriate schema, commands, and connection.
public void AddSqlParameters() { // ... // create myDataSet and myDataAdapter // ... myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"; myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239; myDataAdapter.Fill(myDataSet); }
Public Sub AddParameters() ' ... ' create myDataSet and myDataAdapter ' ... myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters" myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239 myDataAdapter.Fill(myDataSet) End Sub 'AddSqlParameters
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
