You are currently offline, waiting for your internet to reconnect

MSDASQL Provider Improperly Handles Negatively Scaled SQL_NUMERIC_STRUCT Values

This article was previously published under Q274604
This article has been archived. It is offered "as is" and will no longer be updated.
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:
293312INFO: How to Obtain the Latest MDAC 2.5 Service Pack
The 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.
   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   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: 02/27/2014 21:07:06 - Revision: 3.1

Microsoft Data Access Components 1.5, Microsoft Data Access Components 2.0, Microsoft Data Access Components 2.1, Microsoft Data Access Components 2.1 Service Pack 2, Microsoft Data Access Components 2.5

  • kbnosurvey kbarchive kbbug kbfix kbqfe kbmdac250sp3fix kbhotfixserver KB274604