How to set custom OleDb connection properties in ADO.NET?

693 views Asked by At

In COM ADO you can use the Properties collection to set custom properties on a Connection, even after the connection is opened. Is there any equivalent for ADO.NET?

I need this to do some operations on an Access database. The ACE OleDb provider (Microsoft.ACE.OLEDB.12.0) supports many of the same custom connection properties as the former Microsoft.Jet.OLEDB.4.0 provider (see Microsoft OleDb Provider for Jet). A very important one when working with Microsoft Access is the Jet OLEDB:Max Locks Per File property. This property is only available after the connection is open. Including it in the connection string before opening the connection will raise an error:

Could not find installable ISAM

I can accomplish this using COM interop to use the COM ADO Connection, but it would be nice if there was a native ADO.NET way to do this.

0

There are 0 answers