MySql.Data.MySqlClient.MySqlDataReader.GetDecimal C# (CSharp) Method

GetDecimal() public method

public GetDecimal ( int i ) : Decimal
i int
return Decimal
    public override Decimal GetDecimal(int i)
    {
      IMySqlValue v = GetFieldValue(i, true);
      if (v is MySqlDecimal)
        return ((MySqlDecimal)v).Value;
      return Convert.ToDecimal(v.Value);
    }

Same methods

MySqlDataReader::GetDecimal ( string column ) : Decimal

Usage Example

Ejemplo n.º 1
0
        public static PyObject DBColumnToPyObject(int index, ref MySqlDataReader reader)
        {
            Type type = reader.GetFieldType(index);

            switch (type.Name)
            {
                case "String":
                    return new PyString(reader.GetString(index));
                case "UInt32":
                case "Int32":
                case "UInt16":
                case "Int16":
                case "SByte":
                case "Byte":
                    return new PyInt(reader.GetInt32(index));
                case "UInt64":
                case "Int64":
                    return new PyLongLong(reader.GetInt64(index));
                case "Byte[]":
                    return new PyBuffer((byte[])reader.GetValue(index));
                case "Double":
                    return new PyFloat(reader.GetDouble(index));
                case "Decimal":
                    return new PyFloat((double)reader.GetDecimal(index));
                case "Boolean":
                    return new PyBool(reader.GetBoolean(index));
                default:
                    Log.Error("Database", "Unhandled MySQL type " + type.Name);
                    break;
            }

            return null;
        }
All Usage Examples Of MySql.Data.MySqlClient.MySqlDataReader::GetDecimal