Scale Property

OdbcParameter.Scale Property

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

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

[Visual Basic]
Public Overridable Property Scale As Byte  Implements _
public virtual byte Scale {get; set;}
public: __property virtual unsigned char get_Scale();
public: __property virtual void set_Scale(unsigned char);
public function get Scale() : Byte;
public function set Scale(Byte);

Property Value

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.

Note   .NET Framework data providers that ship with .NET Framework version 1.0 do not verify the Scale of Decimal parameter values. This can result in altered 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 using .NET Framework version 1.1 or later, Scale values that exceed the Decimal parameter scale might only be truncated in scale (if that is the behavor of undelying ODBC driver).


[Visual Basic, C#, C++] The following example creates an OdbcParameter and sets some of its properties.

[Visual Basic] 
Public Sub CreateOdbcParameter()
    Dim myParameter As New OdbcParameter("Price", OdbcType.Decimal)
    myParameter.Value = 3.1416
    myParameter.Precision = 8
    myParameter.Scale = 4
End Sub 'CreateOdbcParameter

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

    void CreateOdbcParameter()
        OdbcParameter* myParameter = new OdbcParameter(S"Price", OdbcType::Decimal);
        myParameter->Value = __box(3.1416);
        myParameter->Precision = 8;
        myParameter->Scale = 4;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

OdbcParameter Class | OdbcParameter Members | System.Data.Odbc Namespace | Precision | Size

© 2016 Microsoft