This documentation is archived and is not being maintained.

OleDbParameter.Scale Property

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 only used for decimal and numeric input parameters.

Note   .NET Framework data providers that ship with .NET Framework version 1.0 do not verify the Precision or Scale of Decimal parameter values. This can result in truncated data being inserted at the data source. If you are using .NET Framework version 1.0, validate the Precision and Scale of Decimal values before setting the parameter value. Scale values that exceed the Decimal parameter scale are still truncated.


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

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

public void CreateOleDbParameter() 
    OleDbParameter myParameter = new OleDbParameter("Price", OleDbType.Decimal);
    myParameter.Value = 3.1416;
    myParameter.Precision = 8;
    myParameter.Scale = 4;

void CreateOleDbParameter() 
    OleDbParameter* myParameter = new OleDbParameter(S"Price", OleDbType::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

OleDbParameter Class | OleDbParameter Members | System.Data.OleDb Namespace | Precision | Size