Class MySqlParameter
Represents a parameter to a MySqlCommand, This class cannot be inherited.
Inheritance
Implements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data.dll
Version: 9.1.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
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
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
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
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
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
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
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
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
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
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
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
ToString()
Overridden. Gets a string containing the ParameterName.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Explicit Interface Implementations
ICloneable.Clone()
Declaration
object ICloneable.Clone()
Returns
Type | Description |
---|---|
System.Object |