dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlDecimal Structure
Members Example

In This Topic
    MySqlDecimal Structure
    In This Topic
    Represents MySQL type DECIMAL.
    Syntax
    Remarks
    This structure was created because the System.Decimal type cannot handle all MySQL DECIMAL values. Like MySQL Server, the MySqlDecimal structure internally stores its value as a string, which allows working with huge numbers.
    Example
    The following example demonstrates how to insert to and fetch from a table some MySqlDecimal values.
    MySqlCommand insertCommand = new MySqlCommand("INSERT INTO decimal_test (f_decimal) VALUES (:p1)", connection);
    
     insertCommand.Parameters.Add("p1", MySqlDecimal.MaxValue);
     insertCommand.ExecuteNonQuery();
    
     MySqlCommand selectCommand = new MySqlCommand("SELECT f_decimal FROM decimal_test", connection);
    
     using (MySqlDataReader reader = selectCommand.ExecuteReader())
       while (reader.Read())
         for (int i = 0; i < reader.FieldCount; ++i)
           Console.WriteLine(reader.GetProviderSpecificValue(i));
    Inheritance Hierarchy

    System.Object
       System.ValueType
          Devart.Data.MySql.MySqlDecimal

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also