FIX: The OdbcConnection object does not report an error when you specify a transaction isolation level that is not supported by the data source in the .NET Framework 2.0

This article has been archived. It is offered "as is" and will no longer be updated.
Consider the following scenario. You use the Microsoft .NET Framework Data Provider for ODBC in the .NET Framework 2.0 to connect to a data source in your application. You then use the BeginTransaction method of the OdbcConnection object to start a transaction. You specify a transaction isolation level that is not supported by the data source for the transaction. In this scenario, the OdbcException exception does not occur as expected. However, the exception occurs as expected when you use the .NET Framework 1.1.
This problem occurs because the BeginTransaction method does not report the ODBC error (SQL_ERROR) that the SQLSetConnectAttr function returns. Autocommit mode is the default transaction management mode for the .NET Framework Data Provider for ODBC. The data provider only turns off Autocommit mode when the transaction isolation level is set correctly. Therefore, if you specify an incorrect transaction isolation level, the transaction does not work. If you call the Commit method or the Rollback method, they are invalid. The Commit method and the Rollback method do not report the ODBC error (SQL_ERROR).
A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next NET Framework 2.0 Service Pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.


To apply this hotfix, you must have the Microsoft support files that are described in the following Microsoft Knowledge Base article installed on your computer:
916002 FIX: Error message when you try to use the SqlClient class in an ADO.NET 2.0-based application to connect to an instance of SQL Server 2005: "New request is not allowed to start because it should come with valid transaction descriptor"

Restart requirement

You do not have to restart the computer after you apply this hotfix.

Registry information

You do not have to change the registry.

Hotfix file information

This hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain all of the files that you must have to fully update a product to the latest build.The English version of this hotfix has the file attributes (or later file attributes) 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 item in Control Panel.

.NET Framework 2.0 32-bit version

File nameFile versionFile sizeDateTimePlatform

.NET Framework 2.0 x64-based version

File nameFile versionFile sizeDateTimePlatform

.NET Framework 2.0 Itanium architecture version

File nameFile versionFile sizeDateTimePlatform
To work around this problem, make sure that you use the correct transaction isolation level. You can add code to the application to verify whether the transaction level is correct and to throw an exception in your code.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
For more information about the naming schema for Microsoft SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:
822499 New naming schema for Microsoft SQL Server software update packages

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
This problem may cause data corruption because you cannot use the Rollback method. For example, you can specify an incorrect transaction level. You expect a rollback to occur if data corruption occurs. However, the rollback does not occur. Because the Commit method does not report the error, data corruption may occur because the data may not have been committed as expected.

Steps to reproduce the problem

  1. Create a Microsoft Access data file (.mdb), and then create a table that contains two columns. Assume that the data file is saved in the d:\db1.mdb folder and that the table name is T1. Assume that the two columns are named C1 and C2.
  2. Insert some records into the T1 table.
  3. Create a C# project by using Microsoft Visual Studio 2005, and then paste the following code into a method.
    string cnstr = @"Driver={Microsoft Access Driver (*.mdb)};DBQ=d:\db1.mdb;UID=Admin;PWD=;"OdbcConnection cn = new OdbcConnection(cnstr);cn.Open();System.Diagnostics.Debug.WriteLine("connected.");try{OdbcTransaction trn = cn.BeginTransaction(IsolationLevel.ReadUncommitted);OdbcCommand cmd = new OdbcCommand("select * from T1", C1, C2);OdbcDataReader dr;dr = cmd.ExecuteReader();while (dr.Read()){System.Diagnostics.Debug.WriteLine(dr[1].ToString());}dr.Close();trn.Commit();}catch (OdbcException odbcex){System.Diagnostics.Debug.WriteLine(odbcex.Message);System.Diagnostics.Debug.WriteLine(odbcex.StackTrace);}cn.Close();cn = null;
  4. Run the application, and make sure that you called the method.
After you complete these steps, you will notice that no exception occurs.

Article ID: 917752 - Last Review: 01/17/2015 14:13:50 - Revision: 3.3

Microsoft .NET Framework 2.0

  • kbnosurvey kbarchive kbprb kbtshoot kbexpertiseadvanced KB917752