MSDASQL Provider Improperly Handles Negatively Scaled SQL_NUMERIC_STRUCT Values (274604)



The information in this article applies to:

  • Microsoft Data Access Components 1.5
  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.1 (GA)
  • Microsoft Data Access Components 2.5

This article was previously published under Q274604

SYMPTOMS

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.

RESOLUTION

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  1.10.101.0   484,408  Q277033_w2k_sp3_x86_en.exe
				

WORKAROUND

To work around this problem, use the adUseServer enumeration for the ADO CursorLocation property instead of adUseClient.

STATUS

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.

MORE INFORMATION

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.

Modification Type:MinorLast Reviewed:9/26/2005
Keywords:kbHotfixServer kbQFE kbMDAC250SP3fix kbbug kbfix KB274604