Muokkaa

Jaa


SqlDecimal Struct

Definition

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

public value class SqlDecimal : IComparable, System::Data::SqlTypes::INullable, System::Xml::Serialization::IXmlSerializable
public value class SqlDecimal : IComparable, IEquatable<System::Data::SqlTypes::SqlDecimal>, System::Data::SqlTypes::INullable, System::Xml::Serialization::IXmlSerializable
public value class SqlDecimal : IComparable, System::Data::SqlTypes::INullable
public struct SqlDecimal : IComparable, System.Data.SqlTypes.INullable, System.Xml.Serialization.IXmlSerializable
public struct SqlDecimal : IComparable, IEquatable<System.Data.SqlTypes.SqlDecimal>, System.Data.SqlTypes.INullable, System.Xml.Serialization.IXmlSerializable
public struct SqlDecimal : IComparable, System.Data.SqlTypes.INullable
[System.Serializable]
public struct SqlDecimal : IComparable, System.Data.SqlTypes.INullable, System.Xml.Serialization.IXmlSerializable
type SqlDecimal = struct
    interface INullable
    interface IXmlSerializable
type SqlDecimal = struct
    interface INullable
[<System.Serializable>]
type SqlDecimal = struct
    interface INullable
    interface IXmlSerializable
Public Structure SqlDecimal
Implements IComparable, INullable, IXmlSerializable
Public Structure SqlDecimal
Implements IComparable, IEquatable(Of SqlDecimal), INullable, IXmlSerializable
Public Structure SqlDecimal
Implements IComparable, INullable
Inheritance
SqlDecimal
Attributes
Implements

Remarks

SqlDecimal has different underlying data structures from its corresponding .NET Framework Decimal data type. Decimal has no concept of precision. It uses 3 DWORDs (12 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.

Constructors

SqlDecimal(Byte, Byte, Boolean, Int32, Int32, Int32, Int32)

Initializes a new instance of the SqlDecimal structure using the supplied parameters.

SqlDecimal(Byte, Byte, Boolean, Int32[])

Initializes a new instance of the SqlDecimal structure using the supplied parameters.

SqlDecimal(Decimal)

Initializes a new instance of the SqlDecimal structure using the supplied Decimal value.

SqlDecimal(Double)

Initializes a new instance of the SqlDecimal structure using the supplied double parameter.

SqlDecimal(Int32)

Initializes a new instance of the SqlDecimal structure using the supplied integer value.

SqlDecimal(Int64)

Initializes a new instance of the SqlDecimal structure using the supplied long integer value.

Fields

MaxPrecision

A constant representing the largest possible value for the Precision property.

MaxScale

A constant representing the maximum value for the Scale property.

MaxValue

A constant representing the maximum value of a SqlDecimal structure.

MinValue

A constant representing the minimum value for a SqlDecimal structure.

Null

Represents a DBNull that can be assigned to this instance of the SqlDecimal class.

Properties

BinData

Gets the binary representation of the value of this SqlDecimal structure as an array of bytes.

Data

Gets the binary representation of this SqlDecimal structure as an array of integers.

IsNull

Indicates whether this SqlDecimal structure is null.

IsPositive

Indicates whether the Value of this SqlDecimal structure is greater than zero.

Precision

Gets the maximum number of digits used to represent the Value property.

Scale

Gets the number of decimal places to which Value is resolved.

Value

Gets the value of the SqlDecimal structure. This property is read-only.

Methods

Abs(SqlDecimal)

The Abs method gets the absolute value of the SqlDecimal parameter.

Add(SqlDecimal, SqlDecimal)

Calculates the sum of the two SqlDecimal operators.

AdjustScale(SqlDecimal, Int32, Boolean)

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.

Ceiling(SqlDecimal)

Returns the smallest whole number greater than or equal to the specified SqlDecimal structure.

CompareTo(Object)

Compares this SqlDecimal instance to the supplied Object and returns an indication of their relative values.

CompareTo(SqlDecimal)

Compares this SqlDecimal instance to the supplied SqlDecimal object and returns an indication of their relative values.

ConvertToPrecScale(SqlDecimal, Int32, Int32)

Adjusts the value of the SqlDecimal operand to the indicated precision and scale.

Divide(SqlDecimal, SqlDecimal)

The division operator calculates the results of dividing the first SqlDecimal operand by the second.

Equals(Object)

Compares the supplied Object parameter to the Value property of the SqlDecimal instance.

Equals(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal operands to determine whether they are equal.

Equals(SqlDecimal)

Indicates whether the current instance is equal to another instance of the same type.

Floor(SqlDecimal)

Rounds a specified SqlDecimal number to the next lower whole number.

GetHashCode()

Returns the hash code for this instance.

GetXsdType(XmlSchemaSet)

Returns the XML Schema definition language (XSD) of the specified XmlSchemaSet.

GreaterThan(SqlDecimal, SqlDecimal)

Performs a logical comparison of two SqlDecimal structures to determine whether the first is greater than the second.

GreaterThanOrEqual(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is greater than or equal to the second.

LessThan(SqlDecimal, SqlDecimal)

Performs a logical comparison of two SqlDecimal structures to determine whether the first is less than the second.

LessThanOrEqual(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is less than or equal to the second.

Multiply(SqlDecimal, SqlDecimal)

The multiplication operator computes the product of the two SqlDecimal parameters.

NotEquals(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether they are not equal.

Parse(String)

Converts the String representation of a number to its SqlDecimal equivalent.

Power(SqlDecimal, Double)

Raises the value of the specified SqlDecimal structure to the specified exponential power.

Round(SqlDecimal, Int32)

Gets the number nearest the specified SqlDecimal structure's value with the specified precision.

Sign(SqlDecimal)

Gets a value that indicates the sign of a SqlDecimal structure's Value property.

Subtract(SqlDecimal, SqlDecimal)

Calculates the results of subtracting the second SqlDecimal operand from the first.

ToDouble()

Returns the a double equal to the contents of the Value property of this instance.

ToSqlBoolean()

Converts this SqlDecimal structure to SqlBoolean.

ToSqlByte()

Converts this SqlDecimal structure to SqlByte.

ToSqlDouble()

Converts this SqlDecimal structure to SqlDouble.

ToSqlInt16()

Converts this SqlDecimal structure to SqlInt16.

ToSqlInt32()

Converts this SqlDecimal structure to SqlInt32.

ToSqlInt64()

Converts this SqlDecimal structure to SqlInt64.

ToSqlMoney()

Converts this SqlDecimal structure to SqlMoney.

ToSqlSingle()

Converts this SqlDecimal structure to SqlSingle.

ToSqlString()

Converts this SqlDecimal structure to SqlString.

ToString()

Converts this SqlDecimal structure to String.

Truncate(SqlDecimal, Int32)

Truncates the specified SqlDecimal structure's value to the that you want position.

WriteTdsValue(Span<UInt32>)

Writes the four 32-bit unsigned integer values that make up the SqlDecimal structure into the destination span.

Operators

Addition(SqlDecimal, SqlDecimal)

Calculates the sum of the two SqlDecimal operators.

Division(SqlDecimal, SqlDecimal)

The division operator calculates the results of dividing the first SqlDecimal operand by the second.

Equality(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal operands to determine whether they are equal.

Explicit(Double to SqlDecimal)

Converts the Double parameter to SqlDecimal.

Explicit(SqlBoolean to SqlDecimal)

Converts the supplied SqlBoolean structure to SqlDecimal.

Explicit(SqlDecimal to Decimal)

Converts the SqlDecimal parameter to Decimal.

Explicit(SqlDouble to SqlDecimal)

Converts the supplied SqlDouble structure to SqlDecimal.

Explicit(SqlSingle to SqlDecimal)

Converts the supplied SqlSingle structure to SqlDecimal.

Explicit(SqlString to SqlDecimal)

Converts the supplied SqlString parameter to SqlDecimal.

GreaterThan(SqlDecimal, SqlDecimal)

Performs a logical comparison of two SqlDecimal structures to determine whether the first is greater than the second.

GreaterThanOrEqual(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is greater than or equal to the second.

Implicit(Decimal to SqlDecimal)

Converts the Decimal value to SqlDecimal.

Implicit(Int64 to SqlDecimal)

Converts the supplied Int64 structure to SqlDecimal.

Implicit(SqlByte to SqlDecimal)

Converts the supplied SqlByte structure to SqlDecimal.

Implicit(SqlInt16 to SqlDecimal)

Converts the supplied SqlInt16 structure to SqlDecimal.

Implicit(SqlInt32 to SqlDecimal)

Converts the supplied SqlInt32 structure to SqlDecimal.

Implicit(SqlInt64 to SqlDecimal)

Converts the supplied SqlInt64 structure to SqlDecimal.

Implicit(SqlMoney to SqlDecimal)

Converts the SqlMoney operand to SqlDecimal.

Inequality(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether they are not equal.

LessThan(SqlDecimal, SqlDecimal)

Performs a logical comparison of two SqlDecimal structures to determine whether the first is less than the second.

LessThanOrEqual(SqlDecimal, SqlDecimal)

Performs a logical comparison of the two SqlDecimal parameters to determine whether the first is less than or equal to the second.

Multiply(SqlDecimal, SqlDecimal)

The multiplication operator computes the product of the two SqlDecimal parameters.

Subtraction(SqlDecimal, SqlDecimal)

Calculates the results of subtracting the second SqlDecimal operand from the first.

UnaryNegation(SqlDecimal)

The unary minus operator negates the SqlDecimal parameter.

Explicit Interface Implementations

IXmlSerializable.GetSchema()

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IXmlSerializable.ReadXml(XmlReader)

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IXmlSerializable.WriteXml(XmlWriter)

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Applies to

See also