Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: Trailing Zeros Truncated with ADO OLEDB Provider for ODBC


View products that this article applies to.

This article was previously published under Q237492

↑ Back to the top


Symptoms

When using the OLEDB provider for ODBC, numeric data types returned from the database are returned with the trailing zeros to the left of the decimal place truncated.

For example:

100 would be returned as 1.

2200 would be returned as 22.

↑ Back to the top


Cause

This data truncation is a result of a problem with the translation of the ODBC data type to its equivalent OLEDB data type. This problem occurs when the ODBC driver being used returns a negative value for the scale element of the SQL_C_NUMERIC structure.

↑ Back to the top


Resolution

This has been confirmed to be a bug in the MDAC components. There is a fix for this problem which is discussed in the STATUS section of this article. In addition to this fix, there are several other workarounds to this problem:
  • Modify the query that brings back the numeric type so that the numeric type is converted to strings before returning. For example, "SELECT convert(char(10),field1) FROM TABLENAME."
  • Use the ADO client cursor library instead. This can be done by specifying Connection.CursorLocation = adUseClient.
  • Use the native OLEDB provider for the database, if one is available.

↑ Back to the top


Status

This problem has been fixed in Microsoft ActiveX Data Objects versions 2.5 and later. The fix for this issue is available in MDAC 2.5.

↑ Back to the top


References

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
195470� PRB: MDAC 2.0 ODBC Requirements for Numeric Fields
ODBC 3.0 Programmer's Reference

↑ Back to the top


Keywords: kbhotfixserver, kbqfe, kbbug, kbdatabase, kbfix, kbmdac210sp2fix, kbmdac250fix, kbmdacnosweep, kboledb210fix, kb3rdparty, KB237492

↑ Back to the top

Article Info
Article ID : 237492
Revision : 4
Created on : 9/22/2005
Published on : 9/22/2005
Exists online : False
Views : 460