BUG: SQLOLEDB Incorrectly Converts Char Data When AutoTranslate Is Turned On (331999)
The information in this article applies to:
- Microsoft OLE DB Provider for SQL Server 2000 2000.80.194
- Microsoft OLE DB Provider for SQL Server 2000 2000.80.380.0
- Microsoft OLE DB Provider for SQL Server 2000 2000.81.7713.0
This article was previously published under Q331999 SYMPTOMS When you try to retrieve character data from a column with different collation than the client code page in Microsoft SQL OLE DB Provider (SQLOLEDB), you may receive question marks (??) instead of correct data when all the following conditions are true:
- A connection is made against a Microsoft SQL Server 2000 database.
- SSPROP_INIT_AUTOTRANSLATE is set to TRUE. SSPROP_INIT_AUTOTRANSLATE is part of the provider-specific DBPROPSET_SQLSERVERDBINIT property set.
- A column is bound to an OLEDB DBTYPE_WCHAR data type in the bindings structure.
CAUSE
This is caused by a bug in SQLOLEDB provider.
No conversion should occur in the scenario that this article describes. This is in accordance with SQL Server 2000 Books Online. The following is an excerpt from SQL Server 2000 Books Online:
SSPROP_INIT_AUTOTRANSLATE Type: VT_BOOL
R/W: Read/write
Default: VARIANT_TRUE
Description: OEM/ANSI character conversion.
These settings have no effect on the conversions that occur for these transfers: char, varchar, or text server data sent to a Unicode DBTYPE_WSTR variable on the client.
However, in this scenario, SQLOLEDB does the following:
-
Converts the data from column collation on the SQL Server to Unicode.
- Converts the resultant Unicode string to the client code page.
- Converts the translated ANSI string to Unicode data.
As a result, you see question marks returned instead of correct data. However, when SSPROP_INIT_AUTOTRANSLATE is set to FALSE, the results are as you expect.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 10/2/2003 |
---|
Keywords: | kbbug KB331999 kbAudDeveloper |
---|
|