How can I make OleDbConnection try to connect to a distributed transaction?

I am using OleDB to connect to an excel file using this connection string

@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0 Xml;HDR=YES""" 

But when I do this (what is inside TransactionScope ())

 using (OleDbConnection conn = new OleDbConnection(connectionString)) { conn.Open(); ... } 

I get the following error

The ITransactionLocal interface is not supported by Microsoft.ACE.OLEDB.12.0. Local transactions are not available with the current provider.

How to make OleDbConnection not try to write to a distributed transaction? The SqlConnection class has a ConnectionString property called "Enlist", but I cannot find an equivalent configuration or method for OleDB.

+6
transactions oledb
source share
1 answer

In the connection string, add the following code: "; OLE DB Services = -4;"

+10
source share

All Articles