Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sunday, May 21, 2006 11:08 PM
Hello All,
I am having a bit of a problem here and I am hoping that someone can shed some light on how to solve it. In both DAO and ADO you have the ability to open an Access database in Exclusive Mode. I cannot seem to find a connection string parameter that allows you to achieve this in ADO.Net. Does this functionality exist in ADO.Net? If so, what is the correct syntax for this portion of the connection string? Any help you can offer would be greatly appreciated.
Thanks In Advance,
V. Shane Curtis
Wednesday, May 31, 2006 12:25 AM ✅Answered
You can use the keyword Mode to do this in an OLE DB connection string. The values are the same as the valid values for the classic ADO property that Mary mentioned. The valid values are here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdcstconnectmodeenum.asp
The value you want for Exclusive is 12, so your connection string would look like this:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\northwind.mdb;Mode=12;
Thanks,
Sarah
Tuesday, May 30, 2006 8:51 PM
You can use "Exclusive=1" in an Odbc connection string to open it exclusively, if that helps. An OLE DB Connection object has a .Mode property that you can set to adModeShareExclusive, but I don't know how to translate that into an OleDbConnection connection string.
Saturday, December 1, 2007 6:23 AM
Hi Sarah,
Thanks for the info, I was also looking for Exclusive connection.
I was wondering though, if you don't include the "Mode=" property in the ADO connection string, what mode would the MS Access database open in (the default mode)? Is there C# code I could use to "get" the database's current connection (in open state) mode?
Thanks,
Ron
Saturday, December 1, 2007 6:34 AM
Hi Sarah,
Looks like adModeUnknown is the default? Do you know what the difference is between adModeUnknown and adModeShareDenyNone? Which is less restrictive?
thanks,
Ron