Class MySqlParameterCollection
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.
Implements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data.dll
Version: 9.0.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 |
---|---|
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 |
---|---|
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 |
---|---|
Boolean |
Overrides
IsSynchronized
Gets a value that indicates whether the MySqlParameterCollection object is synchronized.
Declaration
public override bool IsSynchronized { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Item[Int32]
Gets the MySqlParameter at the specified index.
Declaration
public MySqlParameter this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
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 |
---|---|---|
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 |
---|---|
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 |
---|---|---|
Object | value | The MySqlParameter to add to the collection. |
Returns
Type | Description |
---|---|
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 |
---|---|---|
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 |
---|---|---|
String | parameterName | The name of the parameter. |
MySqlDbType | dbType | One of the MySqlDbType values. |
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 |
---|---|---|
String | parameterName | The name of the parameter. |
MySqlDbType | dbType | One of the MySqlDbType values. |
Int32 | size | The length of the column. |
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 |
---|---|---|
String | parameterName | The name of the parameter. |
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 |
---|---|---|
Object | value | The value of the MySqlParameter object to find. |
Returns
Type | Description |
---|---|
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 |
---|---|---|
String | parameterName | The name of the MySqlParameter object to find. |
Returns
Type | Description |
---|---|
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 | |
Int32 | index |
Overrides
GetEnumerator()
Returns an enumerator that iterates through the MySqlParameterCollection.
Declaration
public override IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |
Overrides
GetParameter(Int32)
Declaration
protected override DbParameter GetParameter(int index)
Parameters
Type | Name | Description |
---|---|---|
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 |
---|---|---|
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 |
---|---|---|
Object | value | The MySqlParameter object to locate. |
Returns
Type | Description |
---|---|
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 |
---|---|---|
String | parameterName | The name of the MySqlParameter object to retrieve. |
Returns
Type | Description |
---|---|
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 |
---|---|---|
Int32 | index | |
Object | value |
Overrides
Remove(Object)
Removes the specified MySqlParameter from the collection.
Declaration
public override void Remove(object value)
Parameters
Type | Name | Description |
---|---|---|
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 |
---|---|---|
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 |
---|---|---|
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 |
---|---|---|
Int32 | index | |
System.Data.Common.DbParameter | value |
Overrides
SetParameter(String, DbParameter)
Declaration
protected override void SetParameter(string parameterName, DbParameter value)
Parameters
Type | Name | Description |
---|---|---|
String | parameterName | |
System.Data.Common.DbParameter | value |