This documentation is archived and is not being maintained.

OdbcParameter.Precision Property

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

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

[Visual Basic]
Public Overridable Property Precision As Byte  Implements _
   IDbDataParameter.Precision
[C#]
public virtual byte Precision {get; set;}
[C++]
public: __property virtual unsigned char get_Precision();
public: __property virtual void set_Precision(unsigned char);
[JScript]
public function get Precision() : Byte;
public function set Precision(Byte);

Property Value

The maximum number of digits used to represent the Value property. The default value is 0, which indicates that the data provider sets the precision for Value. Setting the Precision property has no effect.

Implements

IDbDataParameter.Precision

Remarks

Setting the Precision property has no effect.

Example

[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

[C#] 
public void CreateOdbcParameter() 
 {
    OdbcParameter myParameter = new OdbcParameter("Price", OdbcType.Decimal);
    myParameter.Value = 3.1416;
    myParameter.Precision = 8;
    myParameter.Scale = 4;
 }

[C++] 
public:
    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.

Requirements

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 | Scale | Size

Show: