Class MySqlParameterCollection
Represents a collection of parameters relevant to a MySqlCommand as well as their respective mappings to columns in a System.Data.DataSet. This class cannot be inherited.
Inheritance
Implements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data.dll
Version: 9.1.0
Syntax
[ListBindable(true)]
public sealed class MySqlParameterCollection : DbParameterCollection, IDataParameterCollection, IList, ICollection, IEnumerable
Remarks
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.
Properties
Count
Gets the number of MySqlParameter objects in the collection.
Declaration
public override int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
IsFixedSize
Gets a value that indicates whether the MySqlParameterCollection object has a fixed size.
Declaration
public override bool IsFixedSize { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsReadOnly
Gets a value that indicates whether the MySqlParameterCollection object is read-only.
Declaration
public override bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsSynchronized
Gets a value that indicates whether the MySqlParameterCollection object is synchronized.
Declaration
public override bool IsSynchronized { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Item[Int32]
Gets the MySqlParameter at the specified index.
Declaration
public MySqlParameter this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
MySqlParameter |
Item[String]
Gets the MySqlParameter with the specified name.
Declaration
public MySqlParameter this[string name] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Property Value
Type | Description |
---|---|
MySqlParameter |
SyncRoot
Gets an object that can be used to synchronize access to the MySqlParameterCollection.
Declaration
public override object SyncRoot { get; }
Property Value
Type | Description |
---|---|
System.Object |
Overrides
Methods
Add(MySqlParameter)
Adds the specified MySqlParameter object to the MySqlParameterCollection.
Declaration
public MySqlParameter Add(MySqlParameter value)
Parameters
Type | Name | Description |
---|---|---|
MySqlParameter | value | The MySqlParameter to add to the collection. |
Returns
Type | Description |
---|---|
MySqlParameter | The newly added MySqlParameter object. |
Add(Object)
Adds the specified MySqlParameter object to the MySqlParameterCollection.
Declaration
public override int Add(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The MySqlParameter to add to the collection. |
Returns
Type | Description |
---|---|
System.Int32 | The index of the new MySqlParameter object. |
Overrides
Add(String, MySqlDbType)
Adds a MySqlParameter to the MySqlParameterCollection given the parameter name and the data type.
Declaration
public MySqlParameter Add(string parameterName, MySqlDbType dbType)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName | The name of the parameter. |
MySqlDbType | dbType | One of the MySqlDbType values. |
Returns
Type | Description |
---|---|
MySqlParameter | The newly added MySqlParameter object. |
Add(String, MySqlDbType, Int32)
Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, and the column length.
Declaration
public MySqlParameter Add(string parameterName, MySqlDbType dbType, int size)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName | The name of the parameter. |
MySqlDbType | dbType | One of the MySqlDbType values. |
System.Int32 | size | The length of the column. |
Returns
Type | Description |
---|---|
MySqlParameter | The newly added MySqlParameter object. |
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.
Declaration
public MySqlParameter Add(string parameterName, MySqlDbType dbType, int size, string sourceColumn)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName | The name of the parameter. |
MySqlDbType | dbType | One of the MySqlDbType values. |
System.Int32 | size | The length of the column. |
System.String | sourceColumn | The name of the source column. |
Returns
Type | Description |
---|---|
MySqlParameter | The newly added MySqlParameter object. |
AddRange(Array)
Adds an array of values to the end of the MySqlParameterCollection.
Declaration
public override void AddRange(Array values)
Parameters
Type | Name | Description |
---|---|---|
System.Array | values |
Overrides
AddWithValue(String, Object)
Adds a parameter and its value.
Declaration
public MySqlParameter AddWithValue(string parameterName, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName | The name of the parameter. |
System.Object | value | The value of the parameter. |
Returns
Type | Description |
---|---|
MySqlParameter | A MySqlParameter object representing the provided values. |
Clear()
Removes all items from the collection.
Declaration
public override void Clear()
Overrides
Contains(Object)
Gets a value indicating whether a MySqlParameter exists in the collection.
Declaration
public override bool Contains(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value of the MySqlParameter object to find. |
Returns
Type | Description |
---|---|
System.Boolean | true if the collection contains the MySqlParameter object; otherwise, false. |
Overrides
Contains(String)
Gets a value indicating whether a MySqlParameter with the specified parameter name exists in the collection.
Declaration
public override bool Contains(string parameterName)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName | The name of the MySqlParameter object to find. |
Returns
Type | Description |
---|---|
System.Boolean | true if the collection contains the parameter; otherwise, false. |
Overrides
CopyTo(Array, Int32)
Copies MySqlParameter objects from the MySqlParameterCollection to the specified array.
Declaration
public override void CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | |
System.Int32 | index |
Overrides
GetEnumerator()
Returns an enumerator that iterates through the MySqlParameterCollection.
Declaration
public override IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
Overrides
GetParameter(Int32)
Declaration
protected override DbParameter GetParameter(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Returns
Type | Description |
---|---|
System.Data.Common.DbParameter |
Overrides
GetParameter(String)
Retrieve the parameter with the given name.
Declaration
protected override DbParameter GetParameter(string parameterName)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName |
Returns
Type | Description |
---|---|
System.Data.Common.DbParameter |
Overrides
IndexOf(Object)
Gets the location of a MySqlParameter in the collection.
Declaration
public override int IndexOf(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The MySqlParameter object to locate. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based location of the MySqlParameter in the collection. |
Overrides
IndexOf(String)
Gets the location of the MySqlParameter in the collection with a specific parameter name.
Declaration
public override int IndexOf(string parameterName)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName | The name of the MySqlParameter object to retrieve. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based location of the MySqlParameter in the collection. |
Overrides
Insert(Int32, Object)
Inserts a MySqlParameter into the collection at the specified index.
Declaration
public override void Insert(int index, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
System.Object | value |
Overrides
Remove(Object)
Removes the specified MySqlParameter from the collection.
Declaration
public override void Remove(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Overrides
RemoveAt(Int32)
Removes the specified MySqlParameter from the collection using a specific index.
Declaration
public override void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the parameter. |
Overrides
RemoveAt(String)
Removes the specified MySqlParameter from the collection using the parameter name.
Declaration
public override void RemoveAt(string parameterName)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName | The name of the MySqlParameter object to retrieve. |
Overrides
SetParameter(Int32, DbParameter)
Declaration
protected override void SetParameter(int index, DbParameter value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
System.Data.Common.DbParameter | value |
Overrides
SetParameter(String, DbParameter)
Declaration
protected override void SetParameter(string parameterName, DbParameter value)
Parameters
Type | Name | Description |
---|---|---|
System.String | parameterName | |
System.Data.Common.DbParameter | value |