?
Solved

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

Posted on 2007-04-03
9
Medium Priority
?
394 Views
Last Modified: 2008-01-09
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
Comment
Question by:robertjmackay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18844993
can you show the connection string?
if it contains a path, you need to make it differently than in vb.net...
0
 
LVL 39

Expert Comment

by:stevbe
ID: 18845070
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
 

Author Comment

by:robertjmackay
ID: 18845111
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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:robertjmackay
ID: 18845117
If you notice I am using the admin account and controlling what a person can do within the code itself
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 18845153
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
 
LVL 39

Expert Comment

by:stevbe
ID: 18845187
<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
 

Author Comment

by:robertjmackay
ID: 18845194
but when access 2000 does not have the file open, my ASP application can open it fine
0
 
LVL 39

Assisted Solution

by:stevbe
stevbe earned 1000 total points
ID: 18845227
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
 

Author Comment

by:robertjmackay
ID: 18845275
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question