Search Results for

    Show / Hide Table of Contents

    Class MySqlParameter

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

    Inheritance
    Object
    MarshalByRefObject
    DbParameter
    MySqlParameter
    Implements
    IDbDataParameter
    IDataParameter
    ICloneable
    Namespace: MySql.Data.MySqlClient
    Assembly: MySql.Data.dll
    Version: 8.0.32
    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
    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
    String parameterName

    The name of the parameter to map.

    MySqlDbType dbType

    One of the MySqlDbType values.

    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 ParameterDirection, the precision of the parameter, the scale of the parameter, the source column, a 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
    String parameterName

    The name of the parameter to map.

    MySqlDbType dbType

    One of the MySqlDbType values.

    Int32 size

    The length of the parameter.

    ParameterDirection direction

    One of the ParameterDirection values.

    Boolean isNullable

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

    Byte precision

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

    Byte scale

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

    String sourceColumn

    The name of the source column.

    DataRowVersion sourceVersion

    One of the DataRowVersion values.

    Object value

    An Object that is the value of the MySqlParameter.

    Exceptions
    Type Condition
    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
    String parameterName

    The name of the parameter to map.

    MySqlDbType dbType

    One of the MySqlDbType values.

    Int32 size

    The length of the parameter.

    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
    String parameterName

    The name of the parameter to map.

    Object value

    An 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
    DbType
    Overrides
    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
    ParameterDirection
    Overrides
    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
    Boolean
    Overrides
    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
    String
    Overrides
    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
    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
    Byte
    Overrides
    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
    Byte
    Overrides
    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
    Int32
    Overrides
    DbParameter.Size

    SourceColumn

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

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

    SourceColumnNullMapping

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

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

    SourceVersion

    Gets or sets the DataRowVersion to use when loading Value.

    Declaration
    public override DataRowVersion SourceVersion { get; set; }
    Property Value
    Type Description
    DataRowVersion
    Overrides
    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
    Object
    Overrides
    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
    DbParameter.ResetDbType()

    ToString()

    Overridden. Gets a string containing the ParameterName.

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

    Explicit Interface Implementations

    ICloneable.Clone()

    Declaration
    object ICloneable.Clone()
    Returns
    Type Description
    Object

    Implements

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