Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
MSDASQL Provider Improperly Handles Negatively Scaled SQL_NUMERIC_STRUCT Values
Article ID: 274604 - View products that this article applies to.
This article was previously published under Q274604
When you read negatively scaled numeric values from an ODBC driver by using the OLE DB Provider for ODBC (MSDASQL) with the ActiveX Data Objects (ADO) adUseClient cursor enumeration, the values that are returned are truncated.
To resolve this problem, obtain the latest service pack for Microsoft MDAC 2.5. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
293312The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
(http://support.microsoft.com/kb/293312/EN-US/ )INFO: How to Obtain the Latest MDAC 2.5 Service Pack
Date Time Version Size File Name -------------------------------------------------------------------- 31-Jan-2001 18:20 2.53.6131.0 303,376 Msdasql.dll 31-Jan-2001 18:18 2.53.6131.0 16,384 Msdasqlr.dll 31-Jan-2001 18:20 2.53.6131.0 78,096 Msdatl2.dll 31-Jan-2001 18:20 2.53.6131.0 53,520 Msdatt.dll 28-Feb-2001 18:00 220.127.116.11 484,408 Q277033_w2k_sp3_x86_en.exe
To work around this problem, use the adUseServer enumeration for the ADO CursorLocation property instead of adUseClient.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft MDAC 2.5 Service Pack 3.
If you open an ADO Recordset object against any ODBC driver, the OLE DB Provider for ODBC (MSDASQL) is used to provide ODBC to OLE DB translation services. If the result set that is requested contains a numeric field, and if you use the adUseClient enumeration of the CursorLocation property, ADO tries to fetch the numeric field value into an OLEDB DB_NUMERIC structure.
If the underlying ODBC driver reports that it is ODBC 3.0 compliant, MSDASQL tries to bind to SQL_NUMERIC_STRUCT values directly instead of binding to a character string. If the SQL_NUMERIC_STRUCT that the driver returns has a negative scale, and if the client of the MSDASQL provider requests a DB_NUMERIC value, MSDASQL first converts the SQL_NUMERIC_STRUCT to a DB_VARNUMERIC value and then converts to a DB_NUMERIC value. The final conversion to a DB_NUMERIC value is processed incorrectly if the scale is negative, which results in a truncated value.
Article ID: 274604 - Last Review: September 26, 2005 - Revision: 3.1