This documentation is archived and is not being maintained.

OdbcParameter.Scale Property

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

Namespace:  System.Data.Odbc
Assembly:  System.Data (in System.Data.dll)

public byte Scale { get; set; }

Property Value

Type: System.Byte
The number of decimal places to which Value is resolved. The default is 0.



The Scale property is used only for decimal and numeric input parameters.

The effect of setting this property to a value other than the value in the database depends on the implementation of the data provider and may return an error code, or truncate or round data.

The Scale property only affects parameters whose OdbcType is Decimal or Numeric. For other data types, Scale is ignored.

When using SQL Server Native Client 10 (or later) to bind a parameter whose type is Decimal, Numeric, VarNumeric, DBDate, or DBTimeStamp, you must manually specify an appropriate Scale value.


Use of this property to coerce data passed to the database is not supported. To round, truncate, or otherwise coerce data before passing it to the database, use the Math class that is part of the System namespace prior to assigning a value to the parameter's Value property.


.NET Framework data providers that are included with the .NET Framework version 1.0 do not verify the scale of Decimal parameter values. This can cause modified data being inserted at the data source. If you are using .NET Framework version 1.0, validate the scale of decimal values before setting the parameter value. When you use .NET Framework version 1.1 or later versions, scale values that exceed the decimal parameter scale might only be truncated in scale, if that is the behavior of the underlying ODBC driver.

The following example creates an OdbcParameter and sets some of its properties.

public void CreateOdbcParameter() 
    OdbcParameter parameter = new OdbcParameter("Price", OdbcType.Decimal);
    parameter.Value = 3.1416;
    parameter.Precision = 8;
    parameter.Scale = 4;

.NET Framework

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

.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.