Microsoft KB Archive/198943

= PRB: Sybase Query Returns ASP 0101: 80070057 "Unexpected Error" =

Article ID: 198943

Article Last Modified on 11/26/2003

-

APPLIES TO

 Microsoft Active Server Pages 4.0, when used with:  Microsoft Internet Information Server 3.0

 Microsoft Internet Information Server 4.0

 Microsoft Internet Information Services 5.0  Microsoft Data Access Components 2.0</li> Microsoft Data Access Components 2.1</li> Microsoft Data Access Components 2.5</li></ul>

-

<div class="notice_section">

This article was previously published under Q198943

<div class="symptoms_section">

SYMPTOMS
After upgrading to Microsoft Data Access Components (MDAC) 2.0, some queries to a Sybase database using an Intersolv 3.x Sybase ODBC driver result in the following error:

ASP 0101: 80070057 "Unexpected error"

<div class="cause_section">

CAUSE
This behavior occurs because the Intersolv 3.x Sybase ODBC driver is reporting back that it is an ODBC 3.0 compliant driver. Unfortunately, it is not fully ODBC 3.0 compliant.

When you make an ADO call to an ODBC datasource, ADO uses the Microsoft OLE DB Provider for ODBC by default, which is called MSDASQL. The old MSDASQL from MDAC 1.x did not test for ODBC 3.0 compliance. In cases where the field was of type Numeric, the old MSDASQL would bind the data as character data instead of Numeric data as in this case. The new MSDASQL still binds Numeric data as character data if an ODBC driver does not report back ODBC 3.0 compliance.

If the ODBC driver reports back ODBC 3.0 compliance, MSDASQL binds Numeric data as Numeric. This is where the problem occurs. The Intersolv 3.x driver reports back ODBC 3.0 compliance, so MSDASQL attempts to bind the Numeric data as Numeric. Unfortunately, when the data ends in "0", the data binding fails, resulting in the error.

<div class="resolution_section">

RESOLUTION
There are four possible workarounds:   Convert your numeric field to character data in your SQL statement. For example, instead of using the following code SELECT NumField FROM Table you would use the following code: SELECT convert(char(20), NumField) FROM Table This would return the numeric value, but as a type of Character. </li> Use an older version of the Sybase ODBC driver. Version 2.12 of the Sybase ODBC driver does not report back ODBC 3.0 compliance, so MSDASQL binds Numeric data as Character data.</li> Use Intersolv's OLE DB Provider for Sybase. Intersolv's OLE DB Provider for Sybase does not exhibit this behavior. You can download a trial version (30 day) from Intersolv. There are other companies that also supply OLE DB providers for Sybase, which can be found at the following Microsoft Web site:

http://www.microsoft.com/data/oledb/products/product.htm

</li> Revert to MDAC 1.5 and use the 1.5 version of MSDASQL that does not bind Numeric data as Numeric.</li></ul>

<div class="status_section">

STATUS
This behavior is by design and the problem resides in the third-party ODBC driver.

The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Additional query words: error 80070057

Keywords: kberrmsg kbdatabase kbprb kb3rdparty KB198943

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.