--- title: "NumericScale and Precision Properties Example (VB) | Microsoft Docs" ms.prod: sql ms.prod_service: connectivity ms.technology: connectivity ms.custom: "" ms.date: "01/19/2017" ms.reviewer: "" ms.topic: conceptual dev_langs: - "VB" helpviewer_keywords: - "NumericScale property [ADO], Visual Basic example" - "Precision property [ADO], Visual Basic example" ms.assetid: 9c1e2322-c225-49d1-a120-a343f23cea73 author: MightyPen ms.author: genemi --- # NumericScale and Precision Properties Example (VB) This example uses the [NumericScale](../../../ado/reference/ado-api/numericscale-property-ado.md) and [Precision](../../../ado/reference/ado-api/precision-property-ado.md) properties to display the numeric scale and precision of fields in the ***Discounts*** table of the ***Pubs*** database. ``` 'BeginNumericScaleVB 'To integrate this code 'replace the data source and initial catalog values 'in the connection string Public Sub NumericScaleX() ' connection and recordset variables Dim rstDiscounts As ADODB.Recordset Dim Cnxn As ADODB.Connection Dim fldTemp As ADODB.Field Dim strCnxn As String Dim strSQLDiscounts As String ' Open connection Set Cnxn = New ADODB.Connection strCnxn = "Provider='sqloledb';Data Source='MySqlServer';Initial Catalog='Pubs';Integrated Security='SSPI';" Cnxn.Open strCnxn ' Open recordset Set rstDiscounts = New ADODB.Recordset strSQLDiscounts = "Discounts" rstDiscounts.Open strSQLDiscounts, Cnxn, adOpenStatic, adLockReadOnly, adCmdTable ' Display numeric scale and precision of ' numeric and small integer fields For Each fldTemp In rstDiscounts.Fields If fldTemp.Type = adNumeric Or fldTemp.Type = adSmallInt Then MsgBox "Field: " & fldTemp.Name & vbCr & _ "Numeric scale: " & _ fldTemp.NumericScale & vbCr & _ "Precision: " & fldTemp.Precision End If Next fldTemp ' clean up rstDiscounts.Close Cnxn.Close Set rstDiscounts = Nothing Set Cnxn = Nothing End Sub 'EndNumericScaleVB ``` ## See Also [Field Object](../../../ado/reference/ado-api/field-object.md) [NumericScale Property (ADO)](../../../ado/reference/ado-api/numericscale-property-ado.md) [Parameter Object](../../../ado/reference/ado-api/parameter-object.md) [Precision Property (ADO)](../../../ado/reference/ado-api/precision-property-ado.md)