Search Results for

    Show / Hide Table of Contents

    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
    System.Object
    System.MarshalByRefObject
    System.Data.Common.DbParameterCollection
    MySqlParameterCollection
    Implements
    System.Data.IDataParameterCollection
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IEnumerable
    Namespace: MySql.Data.MySqlClient
    Assembly: MySql.Data.dll
    Version: 9.3.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
    System.Data.Common.DbParameterCollection.Count

    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
    System.Data.Common.DbParameterCollection.IsFixedSize

    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
    System.Data.Common.DbParameterCollection.IsReadOnly

    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
    System.Data.Common.DbParameterCollection.IsSynchronized

    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
    System.Data.Common.DbParameterCollection.SyncRoot

    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
    System.Data.Common.DbParameterCollection.Add(System.Object)

    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
    System.Data.Common.DbParameterCollection.AddRange(System.Array)

    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
    System.Data.Common.DbParameterCollection.Clear()

    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
    System.Data.Common.DbParameterCollection.Contains(System.Object)

    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
    System.Data.Common.DbParameterCollection.Contains(System.String)

    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
    System.Data.Common.DbParameterCollection.CopyTo(System.Array, System.Int32)

    GetEnumerator()

    Returns an enumerator that iterates through the MySqlParameterCollection.

    Declaration
    public override IEnumerator GetEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator
    Overrides
    System.Data.Common.DbParameterCollection.GetEnumerator()

    GetParameter(Int32)

    Declaration
    protected override DbParameter GetParameter(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    System.Data.Common.DbParameter
    Overrides
    System.Data.Common.DbParameterCollection.GetParameter(System.Int32)

    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
    System.Data.Common.DbParameterCollection.GetParameter(System.String)

    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
    System.Data.Common.DbParameterCollection.IndexOf(System.Object)

    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
    System.Data.Common.DbParameterCollection.IndexOf(System.String)

    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
    System.Data.Common.DbParameterCollection.Insert(System.Int32, System.Object)

    Remove(Object)

    Removes the specified MySqlParameter from the collection.

    Declaration
    public override void Remove(object value)
    Parameters
    Type Name Description
    System.Object value
    Overrides
    System.Data.Common.DbParameterCollection.Remove(System.Object)

    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
    System.Data.Common.DbParameterCollection.RemoveAt(System.Int32)

    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
    System.Data.Common.DbParameterCollection.RemoveAt(System.String)

    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
    System.Data.Common.DbParameterCollection.SetParameter(System.Int32, System.Data.Common.DbParameter)

    SetParameter(String, DbParameter)

    Declaration
    protected override void SetParameter(string parameterName, DbParameter value)
    Parameters
    Type Name Description
    System.String parameterName
    System.Data.Common.DbParameter value
    Overrides
    System.Data.Common.DbParameterCollection.SetParameter(System.String, System.Data.Common.DbParameter)

    Implements

    System.Data.IDataParameterCollection
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IEnumerable
    In This Article
    Back to top Copyright © 2021, 2025, Oracle and/or its affiliates.