This topic has not yet been rated - Rate this topic

SqlDecimal Structure

Represents a numeric value between - 10^38 +1 and 10^38 - 1, with fixed precision and scale.

Namespace:  System.Data.SqlTypes
Assembly:  System.Data (in System.Data.dll)
[SerializableAttribute]
public struct SqlDecimal : INullable, 
	IComparable, IXmlSerializable

The SqlDecimal type exposes the following members.

  Name Description
Public method Supported by the XNA Framework SqlDecimal(Decimal) Initializes a new instance of the SqlDecimal structure using the supplied Decimal value.
Public method Supported by the XNA Framework SqlDecimal(Double) Initializes a new instance of the SqlDecimal structure using the supplied double parameter.
Public method Supported by the XNA Framework SqlDecimal(Int32) Initializes a new instance of the SqlDecimal structure using the supplied integer value.
Public method Supported by the XNA Framework SqlDecimal(Int64) Initializes a new instance of the SqlDecimal structure using the supplied long integer value.
Public method Supported by the XNA Framework SqlDecimal(Byte, Byte, Boolean, Int32[]) Initializes a new instance of the SqlDecimal structure using the supplied parameters.
Public method Supported by the XNA Framework SqlDecimal(Byte, Byte, Boolean, Int32, Int32, Int32, Int32) Initializes a new instance of the SqlDecimal structure using the supplied parameters.
Top
  Name Description
Public property Supported by the XNA Framework BinData Get the binary representation of the value of this SqlDecimal structure as an array of bytes.
Public property Supported by the XNA Framework Data Gets the binary representation of this SqlDecimal structure as an array of integers.
Public property Supported by the XNA Framework IsNull Indicates whether this SqlDecimal structure is null.
Public property Supported by the XNA Framework IsPositive Indicates whether the Value of this SqlDecimal structure is greater than zero.
Public property Supported by the XNA Framework Precision Gets the maximum number of digits used to represent the Value property.
Public property Supported by the XNA Framework Scale Gets the number of decimal places to which Value is resolved.
Public property Supported by the XNA Framework Value Gets the value of the SqlDecimal structure. This property is read-only.
Top
  Name Description
Public method Static member Supported by the XNA Framework Abs The Abs method gets the absolute value of the SqlDecimal parameter.
Public method Static member Supported by the XNA Framework Add Calculates the sum of the two SqlDecimal operators.
Public method Static member Supported by the XNA Framework AdjustScale The scale of the SqlDecimal operand will be adjusted to the number of digits indicated by the digits parameter. Depending on the value of the fRound parameter, the value will either be rounded to the appropriate number of digits or truncated.
Public method Static member Supported by the XNA Framework Ceiling Returns the smallest whole number greater than or equal to the specified SqlDecimal structure.
Public method Supported by the XNA Framework CompareTo(Object) Compares this SqlDecimal instance to the supplied Object and returns an indication of their relative values.
Public method Supported by the XNA Framework CompareTo(SqlDecimal) Compares this SqlDecimal instance to the supplied SqlDecimal object and returns an indication of their relative values.
Public method Static member Supported by the XNA Framework ConvertToPrecScale Adjusts the value of the SqlDecimal operand to the indicated precision and scale.
Public method Static member Supported by the XNA Framework Divide The division operator calculates the results of dividing the first SqlDecimal operand by the second.
Public method Supported by the XNA Framework Equals(Object) Compares the supplied Object parameter to the Value property of the SqlDecimal instance. (Overrides ValueType.Equals(Object).)
Public method Static member Supported by the XNA Framework Equals(SqlDecimal, SqlDecimal) Performs a logical comparison of the two SqlDecimal operands to determine whether they are equal.
Protected method Supported by the XNA Framework Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method Static member Supported by the XNA Framework Floor Rounds a specified SqlDecimal number to the next lower whole number.
Public method Supported by the XNA Framework GetHashCode Returns the hash code for this instance. (Overrides ValueType.GetHashCode().)
Public method Supported by the XNA Framework GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Static member Supported by the XNA Framework GetXsdType Returns the XML Schema definition language (XSD) of the specified XmlSchemaSet.
Public method Static member Supported by the XNA Framework GreaterThan Performs a logical comparison of two SqlDecimal structures to determine whether the first is greater than the second.
Public method Static member Supported by the XNA Framework GreaterThanOrEqual Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is greater than or equal to the second.
Public method Static member Supported by the XNA Framework LessThan Performs a logical comparison of two SqlDecimal structures to determine whether the first is less than the second.
Public method Static member Supported by the XNA Framework LessThanOrEqual Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is less than or equal to the second.
Protected method Supported by the XNA Framework MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Static member Supported by the XNA Framework Multiply The multiplication operator computes the product of the two SqlDecimal parameters.
Public method Static member Supported by the XNA Framework NotEquals Performs a logical comparison of the two SqlDecimal parameters to determine whether they are not equal.
Public method Static member Supported by the XNA Framework Parse Converts the String representation of a number to its SqlDecimal equivalent.
Public method Static member Supported by the XNA Framework Power Raises the value of the specified SqlDecimal structure to the specified exponential power.
Public method Static member Supported by the XNA Framework Round Gets the number nearest the specified SqlDecimal structure's value with the specified precision.
Public method Static member Supported by the XNA Framework Sign Gets a value that indicates the sign of a SqlDecimal structure's Value property.
Public method Static member Supported by the XNA Framework Subtract Calculates the results of subtracting the second SqlDecimal operand from the first.
Public method Supported by the XNA Framework ToDouble Returns the a double equal to the contents of the Value property of this instance.
Public method Supported by the XNA Framework ToSqlBoolean Converts this SqlDecimal structure to SqlBoolean.
Public method Supported by the XNA Framework ToSqlByte Converts this SqlDecimal structure to SqlByte.
Public method Supported by the XNA Framework ToSqlDouble Converts this SqlDecimal structure to SqlDouble.
Public method Supported by the XNA Framework ToSqlInt16 Converts this SqlDecimal structure to SqlInt16.
Public method Supported by the XNA Framework ToSqlInt32 Converts this SqlDecimal structure to SqlInt32.
Public method Supported by the XNA Framework ToSqlInt64 Converts this SqlDecimal structure to SqlInt64.
Public method Supported by the XNA Framework ToSqlMoney Converts this SqlDecimal structure to SqlMoney.
Public method Supported by the XNA Framework ToSqlSingle Converts this SqlDecimal structure to SqlSingle.
Public method Supported by the XNA Framework ToSqlString Converts this SqlDecimal structure to SqlString.
Public method Supported by the XNA Framework ToString Converts this SqlDecimal structure to String. (Overrides ValueType.ToString().)
Public method Static member Supported by the XNA Framework Truncate Truncates the specified SqlDecimal structure's value to the that you want position.
Top
  Name Description
Public operator Static member Supported by the XNA Framework Addition Calculates the sum of the two SqlDecimal operators.
Public operator Static member Supported by the XNA Framework Division The division operator calculates the results of dividing the first SqlDecimal operand by the second.
Public operator Static member Supported by the XNA Framework Equality Performs a logical comparison of the two SqlDecimal operands to determine whether they are equal.
Public operator Static member Supported by the XNA Framework Explicit(Double to SqlDecimal) Converts the Double parameter to SqlDecimal.
Public operator Static member Supported by the XNA Framework Explicit(SqlBoolean to SqlDecimal) Converts the supplied SqlBoolean structure to SqlDecimal.
Public operator Static member Supported by the XNA Framework Explicit(SqlDecimal to Decimal) Converts the SqlDecimal parameter to Decimal.
Public operator Static member Supported by the XNA Framework Explicit(SqlDouble to SqlDecimal) Converts the supplied SqlDouble structure to SqlDecimal.
Public operator Static member Supported by the XNA Framework Explicit(SqlSingle to SqlDecimal) Converts the supplied SqlSingle structure to SqlDecimal.
Public operator Static member Supported by the XNA Framework Explicit(SqlString to SqlDecimal) Converts the supplied SqlString parameter to SqlDecimal.
Public operator Static member Supported by the XNA Framework GreaterThan Performs a logical comparison of two SqlDecimal structures to determine whether the first is greater than the second.
Public operator Static member Supported by the XNA Framework GreaterThanOrEqual Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is greater than or equal to the second.
Public operator Static member Supported by the XNA Framework Implicit(Decimal to SqlDecimal) Converts the Decimal value to SqlDecimal.
Public operator Static member Supported by the XNA Framework Implicit(Int64 to SqlDecimal) Converts the supplied Int64 structure to SqlDecimal.
Public operator Static member Supported by the XNA Framework Implicit(SqlByte to SqlDecimal) Converts the supplied SqlByte structure to SqlDecimal.
Public operator Static member Supported by the XNA Framework Implicit(SqlInt16 to SqlDecimal) Converts the supplied SqlInt16 structure to SqlDecimal
Public operator Static member Supported by the XNA Framework Implicit(SqlInt32 to SqlDecimal) Converts the supplied SqlInt32 structure to SqlDecimal.
Public operator Static member Supported by the XNA Framework Implicit(SqlInt64 to SqlDecimal) Converts the supplied SqlInt64 structure to SqlDecimal.
Public operator Static member Supported by the XNA Framework Implicit(SqlMoney to SqlDecimal) Converts the SqlMoney operand to SqlDecimal.
Public operator Static member Supported by the XNA Framework Inequality Performs a logical comparison of the two SqlDecimal parameters to determine whether they are not equal.
Public operator Static member Supported by the XNA Framework LessThan Performs a logical comparison of two SqlDecimal structures to determine whether the first is less than the second.
Public operator Static member Supported by the XNA Framework LessThanOrEqual Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is less than or equal to the second.
Public operator Static member Supported by the XNA Framework Multiply The multiplication operator computes the product of the two SqlDecimal parameters.
Public operator Static member Supported by the XNA Framework Subtraction Calculates the results of subtracting the second SqlDecimal operand from the first.
Public operator Static member Supported by the XNA Framework UnaryNegation The unary minus operator negates the SqlDecimal parameter.
Top
  Name Description
Public field Static member Supported by the XNA Framework MaxPrecision A constant representing the largest possible value for the Precision property.
Public field Static member Supported by the XNA Framework MaxScale A constant representing the maximum value for the Scale property.
Public field Static member Supported by the XNA Framework MaxValue A constant representing the maximum value of a SqlDecimal structure.
Public field Static member Supported by the XNA Framework MinValue A constant representing the minimum value for a SqlDecimal structure.
Public field Static member Supported by the XNA Framework Null Represents a DBNull that can be assigned to this instance of the SqlDecimalclass.
Top
  Name Description
Explicit interface implemetation Private method Supported by the XNA Framework IXmlSerializable.GetSchema This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Explicit interface implemetation Private method Supported by the XNA Framework IXmlSerializable.ReadXml This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Explicit interface implemetation Private method Supported by the XNA Framework IXmlSerializable.WriteXml This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Top

SqlDecimal has different underlying data structures from its corresponding .NET Framework Decimal data type. Decimal has no concept of precision. It uses 3 bytes to store the actual data, and therefore has a maximum scale of 28. The data range is -79,228,162,514,264,337,593,543,950,335 through 79,228,162,514,264,337,593,543,950,335. SqlDecimal has both precision and scale. It uses 4 unsigned 4-byte integers to store the actual data, and therefore has maximum precision and scale of 38. The data range is - 10^38 +1 through 10^38 - 1.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ