|
Having trouble connecting to Access database with .NET 2.0 -- damienplunkett --
I am re-working a website from asp to asp.net. The site is using multiple Access databases. The site with asp can read the database even though I might have it open on my local machine. The asp.net version, using the same connection objects and recordsets, will not open the database. I get an error that says: "Cannot open file '' file already in use." I have tried multiple combinations of connection objects, recordsets, readers, datasets and adapters. Nothing seems to allow me to connect while the file is open. Here is the syntax for one of the connections (it is almost exactly the same as the older asp site's syntax): Dim Con_Obj As New ADODB.Connection Dim RS_Obj As New ADODB.Recordset With Con_Obj .Provider = "Microsoft.Jet.OLEDB.4.0" .Open("C:\database\news.mdb") <-- it fails here End With SelectStatement = "SELECT * FROM News where Archive=False and Rank > 1 ORDER BY Rank DESC, PostDate DESC" RS_Obj.Open(SelectStatement, Con_Obj, 1, 1) In other reads I am using OleDbConnection object and an OleDbDataReader with the same results. If anyone knows how I can connect to the database while it is open on a local machine your help would be greatly appreciated. Thanks |
|
-- damienplunkett --
Well I figured out my own problem...it had nothing to do with the way I was connecting to the database. The problem was, I was opening it as the owner/administrator which had more rights to the folder than the web user. I removed all of the unnecessary users and have: System, Everyone, Computername\Computername_IUSER. I believe this allowed the internet user the same access to the database that i would have as an administrator on the box. So I'm not locking it everytime I open it as an administrator. |