Search Results for

    Show / Hide Table of Contents

    Class MySqlParameter

    Represents a parameter to a MySqlCommand, This class cannot be inherited.

    Inheritance
    System.Object
    System.MarshalByRefObject
    System.Data.Common.DbParameter
    MySqlParameter
    Implements
    System.Data.IDbDataParameter
    System.Data.IDataParameter
    System.ICloneable
    Namespace: MySql.Data.MySqlClient
    Assembly: MySql.Data.dll
    Version: 9.3.0
    Syntax
    [TypeConverter(typeof(MySqlParameterConverter))]
    public sealed class MySqlParameter : DbParameter, IDbDataParameter, IDataParameter, ICloneable
    Remarks

    Parameter names are not case sensitive. You can read more about it here.

    Constructors

    MySqlParameter()

    Declaration
    public MySqlParameter()

    MySqlParameter(String, MySqlDbType)

    Initializes a new instance of the MySqlParameter class with the parameter name and the data type.

    Declaration
    public MySqlParameter(string parameterName, MySqlDbType dbType)
    Parameters
    Type Name Description
    System.String parameterName

    The name of the parameter to map.

    MySqlDbType dbType

    One of the MySqlDbType values.

    MySqlParameter(String, MySqlDbType, Int32)

    Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType, and the size.

    Declaration
    public MySqlParameter(string parameterName, MySqlDbType dbType, int size)
    Parameters
    Type Name Description
    System.String parameterName

    The name of the parameter to map.

    MySqlDbType dbType

    One of the MySqlDbType values.

    System.Int32 size

    The length of the parameter.

    MySqlParameter(String, MySqlDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

    Initializes a new instance of the MySqlParameter class with the parameter name, the type of the parameter, the size of the parameter, a System.Data.ParameterDirection, the precision of the parameter, the scale of the parameter, the source column, a System.Data.DataRowVersion to use, and the value of the parameter.

    Declaration
    public MySqlParameter(string parameterName, MySqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value)
    Parameters
    Type Name Description
    System.String parameterName

    The name of the parameter to map.

    MySqlDbType dbType

    One of the MySqlDbType values.

    System.Int32 size

    The length of the parameter.

    System.Data.ParameterDirection direction

    One of the System.Data.ParameterDirection values.

    System.Boolean isNullable

    true if the value of the field can be null, otherwise false.

    System.Byte precision

    The total number of digits to the left and right of the decimal point to which Value is resolved.

    System.Byte scale

    The total number of decimal places to which Value is resolved.

    System.String sourceColumn

    The name of the source column.

    System.Data.DataRowVersion sourceVersion

    One of the System.Data.DataRowVersion values.

    System.Object value

    An System.Object that is the value of the MySqlParameter.

    Exceptions
    Type Condition
    System.ArgumentException

    MySqlParameter(String, MySqlDbType, Int32, String)

    Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType, the size, and the source column name.

    Declaration
    public MySqlParameter(string parameterName, MySqlDbType dbType, int size, string sourceColumn)
    Parameters
    Type Name Description
    System.String parameterName

    The name of the parameter to map.

    MySqlDbType dbType

    One of the MySqlDbType values.

    System.Int32 size

    The length of the parameter.

    System.String sourceColumn

    The name of the source column.

    MySqlParameter(String, Object)

    Initializes a new instance of the MySqlParameter class with the parameter name and a value of the new MySqlParameter.

    Declaration
    public MySqlParameter(string parameterName, object value)
    Parameters
    Type Name Description
    System.String parameterName

    The name of the parameter to map.

    System.Object value

    An System.Object that is the value of the MySqlParameter.

    Properties

    DbType

    Gets or sets the DbType of the parameter.

    Declaration
    public override DbType DbType { get; set; }
    Property Value
    Type Description
    System.Data.DbType
    Overrides
    System.Data.Common.DbParameter.DbType

    Direction

    Gets or sets a value indicating whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter. As of MySql version 4.1 and earlier, input-only is the only valid choice.

    Declaration
    public override ParameterDirection Direction { get; set; }
    Property Value
    Type Description
    System.Data.ParameterDirection
    Overrides
    System.Data.Common.DbParameter.Direction

    IsNullable

    Gets or sets a value indicating whether the parameter accepts null values.

    Declaration
    [Browsable(false)]
    public override bool IsNullable { get; set; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    System.Data.Common.DbParameter.IsNullable

    MySqlDbType

    Gets or sets the MySqlDbType of the parameter.

    Declaration
    [DbProviderSpecificTypeProperty(true)]
    public MySqlDbType MySqlDbType { get; set; }
    Property Value
    Type Description
    MySqlDbType

    ParameterName

    Declaration
    public override string ParameterName { get; set; }
    Property Value
    Type Description
    System.String
    Overrides
    System.Data.Common.DbParameter.ParameterName

    PossibleValues

    Returns the possible values for this parameter if this parameter is of type SET or ENUM. Returns null otherwise.

    Declaration
    public IList PossibleValues { get; }
    Property Value
    Type Description
    System.Collections.IList

    Precision

    Gets or sets the maximum number of digits used to represent the Value property.

    Declaration
    public override byte Precision { get; set; }
    Property Value
    Type Description
    System.Byte
    Overrides
    System.Data.Common.DbParameter.Precision

    Scale

    Gets or sets the number of decimal places to which Value is resolved.

    Declaration
    public override byte Scale { get; set; }
    Property Value
    Type Description
    System.Byte
    Overrides
    System.Data.Common.DbParameter.Scale

    Size

    Gets or sets the maximum size, in bytes, of the data within the column.

    Declaration
    public override int Size { get; set; }
    Property Value
    Type Description
    System.Int32
    Overrides
    System.Data.Common.DbParameter.Size

    SourceColumn

    Gets or sets the name of the source column that is mapped to the System.Data.DataSet and used for loading or returning the Value.

    Declaration
    public override string SourceColumn { get; set; }
    Property Value
    Type Description
    System.String
    Overrides
    System.Data.Common.DbParameter.SourceColumn

    SourceColumnNullMapping

    Sets or gets a value which indicates whether the source column is nullable. This allows System.Data.Common.DbCommandBuilder to correctly generate Update statements for nullable columns.

    Declaration
    public override bool SourceColumnNullMapping { get; set; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    System.Data.Common.DbParameter.SourceColumnNullMapping

    SourceVersion

    Gets or sets the System.Data.DataRowVersion value to use when loading Value.

    Declaration
    public override DataRowVersion SourceVersion { get; set; }
    Property Value
    Type Description
    System.Data.DataRowVersion
    Overrides
    System.Data.Common.DbParameter.SourceVersion

    Value

    Gets or sets the value of the parameter.

    Declaration
    [TypeConverter(typeof(StringConverter))]
    public override object Value { get; set; }
    Property Value
    Type Description
    System.Object
    Overrides
    System.Data.Common.DbParameter.Value

    Methods

    Clone()

    Clones this object.

    Declaration
    public MySqlParameter Clone()
    Returns
    Type Description
    MySqlParameter

    An object that is a clone of this object.

    ResetDbType()

    Resets the DbType property to its original settings.

    Declaration
    public override void ResetDbType()
    Overrides
    System.Data.Common.DbParameter.ResetDbType()

    ToString()

    Overridden. Gets a string containing the ParameterName.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()

    Explicit Interface Implementations

    ICloneable.Clone()

    Declaration
    object ICloneable.Clone()
    Returns
    Type Description
    System.Object

    Implements

    System.Data.IDbDataParameter
    System.Data.IDataParameter
    System.ICloneable
    In This Article
    Back to top Copyright © 2021, 2025, Oracle and/or its affiliates.