Argentini.Halide.H3Reader.GetDecimal C# (CSharp) Method

GetDecimal() public method

Read a column value in as a decimal.
public GetDecimal ( string columnName ) : decimal
columnName string Name of column to retrieve.
return decimal
        public decimal GetDecimal(string columnName)
        {
            decimal output = 0;

            try
            {
                int ord = (dr_Oledb != null ? dr_Oledb.GetOrdinal(columnName) : dr.GetOrdinal(columnName));

                if (dr_Oledb != null)
                {
                    if (dr_Oledb.IsDBNull(ord))
                    {
                        output = 0;
                    }

                    else
                    {
                        output = Convert.ToDecimal(dr_Oledb[ord].ToString());
                    }
                }

                else
                {
                    if (dr.IsDBNull(ord))
                    {
                        output = 0;
                    }

                    else
                    {
                        output = Convert.ToDecimal(dr[ord].ToString());
                    }
                }
            }

            catch (Exception err)
            {
                _lastSqlError = err;
            }

            return output;
        }