Issues Connecting to an Access 2000 Database...
I am trying to create a web service that uploads the data contained in a local database for future use. I am using Visual C# .NET and trying to connect to an Access 2000 database.
Using the Server Explorer I can successfully create a connection to the database and then browse the tables and add/remove data using the built in Visual Studio design tools. Help suggests that I drag the connection object into the design window of my web service and code will be generated to connect to the database. This works fine but when I try to run the web service to test the web method, I get the following error:
System.Data.OleDb.OleDbException: The Microsoft Jet database engine cannot open the file 'C:\Documents and Settings\Jonny\My Documents\Visual Studio Projects\ECS\ECS Database.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
The file is not opened by any other user since there is no .ldb Access Record-Locking Information file present in the directory of the database. From this I can assume that it must be a permissions problem yet I am logging in with the Admin account (which has no password).
- I have disabled IIS control of password for the web service.
- The Admin account in the database has full read/write permissions.
- I have .NET v 1.1, Microsoft Data Access Components (MDAC) 2.6 and the newest version of the Jet database engine.
The connection string generated by Visual Studio is as follows:
this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source=""C:\Documents and Settings\Jonny\My Documents\Visual Studio Projects\ECS\ECS Database.mdb"";Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0" ";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False";
I can't see why this connection string would work within the Server Explorer but not when in my code...
Thanks in advance for and help/suggestions.