• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 402
  • Last Modified:

Could not use ''; file already in use - ASP.NET / Access 2000

I have an ASP.NET (VB) application that uses data an Access 2000 table.  

I am having a problem where if I open the file with Access 2000, the attempt to open the file in an ASP.NET application, the following error is generated: Could not use ''; file already in use ... System.Data.OleDb.OleDbException: Could not use ''; file already in use.

IMPORTANT - I use the identical connection string in a VB.NET windows application without any problem at all.  However, as soon as I use it in a web application (ASP.NET) it gives me the error.
0
robertjmackay
Asked:
robertjmackay
  • 4
  • 3
  • 2
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
can you show the connection string?
if it contains a path, you need to make it differently than in vb.net...
0
 
stevbeCommented:
the mdb file must be set to open shared as the default
Tools-->Options-->Advanced, check the Sahred box.

both accounts, yours and the account the code will be executing under need to have create, modify and delete permissions on the folder the mdb file is in.

Steve
0
 
robertjmackayAuthor Commented:
connection_string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\my documents\consult\rmacdata\rjmdata.mdb;Jet OLEDB:Database Password="""";User ID=admin"
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
robertjmackayAuthor Commented:
If you notice I am using the admin account and controlling what a person can do within the code itself
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
do NOT place the access database in "my documents" or the like, when working with asp projects.
put it in a dedicated folder.
the problem is quite sure that the asp / iis process does not have access to your private folder, hence the connection error.
0
 
stevbeCommented:
<If you notice I am using the admin account and controlling what a person can do within the code itself>
The connection string has nothing to do with the file permissions directly in the OS which is where you need to check. Access automatically creates a file with the same name as the database file but with an .ldb extension to track record locks. If it can not create that file it will open in Exclusive mode for the first instance which then blocks all other attempts to connect.

Steve
0
 
robertjmackayAuthor Commented:
but when access 2000 does not have the file open, my ASP application can open it fine
0
 
stevbeCommented:
exactly ...
"If it can not create that file it will open in Exclusive mode for the first instance which then blocks all other attempts to connect."

Steve

0
 
robertjmackayAuthor Commented:
Well done.  I split the points as between answers I received from both Stevbe & angelll , I was able to get it working.

thanks folks
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now