Neither the isolation level nor a strengthening of it is supported

1

Using

Microsoft SQL Server 2008 (SP1)

Trying to create transaction like so:

OleDbConnection con;
OleDbTransaction transaction = null;
...
transaction = con.BeginTransaction(IsolationLevel.Snapshot);

And get error:

System.Data.OleDb.OleDbException (0x8004D008): Neither the isolation level nor a strengthening of it is supported.
   at System.Data.OleDb.OleDbTransaction.ProcessResults(OleDbHResult hr)
   at System.Data.OleDb.OleDbTransaction.BeginInternal(ITransactionLocal

transaction) at System.Data.OleDb.OleDbConnectionInternal.BeginTransaction(IsolationLevel isolationLevel) at System.Data.OleDb.OleDbConnection.BeginTransaction(IsolationLevel isolationLevel)

I made sure to run the following in the SQL Server Management Studio:

ALTER DATABASE mydb SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
ALTER DATABASE mydb  SET ALLOW_SNAPSHOT_ISOLATION ON;
ALTER DATABASE mydb  SET READ_COMMITTED_SNAPSHOT ON;
ALTER DATABASE mydb  SET MULTI_USER;

Anything I'm missing?

sql-server
database
sql-server-2008
asked on Stack Overflow Mar 15, 2012 by Alex

1 Answer

2

Replace OleDb with SqlClient (as Oded suggested in a comment).

Or alternatively, execute this SQL command before beginning the transaction:

SET TRANSACTION ISOLATION LEVEL SNAPSHOT;
answered on Stack Overflow Mar 15, 2012 by Anthony Faull

User contributions licensed under CC BY-SA 3.0