473,287 Members | 1,643 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Could not use ''; file already in use

I've read a couple of threads on this error but none of them could help me so
I'm posting myself.

When I try open and read (not update) an ACCESS database on a network share
I occasionally get:

"Could not use ''; file already in use." error.

This always happens when the database is open but sometimes even when it's
not. Not manually anyway. I consequently use DataAdapter.Fill() method which
should close the connection, right? Anyway, It must work even when the
database is open (not design mode). It does so when I run the application
against a database on the webbserver. What's the difference when its on a
network share? The IUSR has full rights on the database-folder. And as I said
earlier it works, but not always so it's unlikely a basic security problem.
There must be some way to force ASP.NET to read an open database. Can anybody
please help me?

/Miro
Nov 19 '05 #1
4 9447
Access is not a good fit for web applications. I've seen your
error occur often times when you don't properly close
the connection "in every instance" and the lock file
gets left.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net

"Miro" <Mi**@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
I've read a couple of threads on this error but none of them could help me
so
I'm posting myself.

When I try open and read (not update) an ACCESS database on a network
share
I occasionally get:

"Could not use ''; file already in use." error.

This always happens when the database is open but sometimes even when it's
not. Not manually anyway. I consequently use DataAdapter.Fill() method
which
should close the connection, right? Anyway, It must work even when the
database is open (not design mode). It does so when I run the application
against a database on the webbserver. What's the difference when its on a
network share? The IUSR has full rights on the database-folder. And as I
said
earlier it works, but not always so it's unlikely a basic security
problem.
There must be some way to force ASP.NET to read an open database. Can
anybody
please help me?

/Miro

Nov 19 '05 #2
Even you said it worked earlier, still the most possible reason could the
user account running the ASP.NET appdoes not have read/write permission to
the *.mdb file. Before you can tell whether the folder where *.mdb is
licated is allowed full access to some users, you have to make sure who is
exactly access it. Are you sure the ASP.NET app or apps run with
IUSR_MachineName account? (By default. ASP.NET runs on ASPNET/Network
Service account, unless you set "impersonate=true" for the ASP.NET app or
apps.

"Miro" <Mi**@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
I've read a couple of threads on this error but none of them could help me
so
I'm posting myself.

When I try open and read (not update) an ACCESS database on a network
share
I occasionally get:

"Could not use ''; file already in use." error.

This always happens when the database is open but sometimes even when it's
not. Not manually anyway. I consequently use DataAdapter.Fill() method
which
should close the connection, right? Anyway, It must work even when the
database is open (not design mode). It does so when I run the application
against a database on the webbserver. What's the difference when its on a
network share? The IUSR has full rights on the database-folder. And as I
said
earlier it works, but not always so it's unlikely a basic security
problem.
There must be some way to force ASP.NET to read an open database. Can
anybody
please help me?

/Miro

Nov 19 '05 #3
Thanks!

Yes, I'm using impersonate=true to be absolutely sure that the user has full
rights on the folder. The database is on a Novell File Server and I had big
troubles get it working in the first place. Finally I got some expert-help
from Microsoft which solved it, for a while. Actually, it's not IUSR but som
new account created in both IIS and Novell. But I'm sure the account has full
rights.

/Miro
"Norman Yuan" wrote:
Even you said it worked earlier, still the most possible reason could the
user account running the ASP.NET appdoes not have read/write permission to
the *.mdb file. Before you can tell whether the folder where *.mdb is
licated is allowed full access to some users, you have to make sure who is
exactly access it. Are you sure the ASP.NET app or apps run with
IUSR_MachineName account? (By default. ASP.NET runs on ASPNET/Network
Service account, unless you set "impersonate=true" for the ASP.NET app or
apps.

"Miro" <Mi**@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
I've read a couple of threads on this error but none of them could help me
so
I'm posting myself.

When I try open and read (not update) an ACCESS database on a network
share
I occasionally get:

"Could not use ''; file already in use." error.

This always happens when the database is open but sometimes even when it's
not. Not manually anyway. I consequently use DataAdapter.Fill() method
which
should close the connection, right? Anyway, It must work even when the
database is open (not design mode). It does so when I run the application
against a database on the webbserver. What's the difference when its on a
network share? The IUSR has full rights on the database-folder. And as I
said
earlier it works, but not always so it's unlikely a basic security
problem.
There must be some way to force ASP.NET to read an open database. Can
anybody
please help me?

/Miro


Nov 19 '05 #4
Thanks!

What must I do to be absolutely sure that the connection is closed. This is
the function I'm using:

public DataSet GetFromAccessDatabase(String SQLQuery)
{
OleDbConnection conn = new OleDbConnection(this._ConnectionString);
OleDbCommand select = new OleDbCommand(SQLQuery);
OleDbDataAdapter dataAD = new OleDbDataAdapter();
dataAD.SelectCommand = select;
select.Connection = conn;
DataSet mds = new DataSet();
dataAD.Fill(mds);
select.Connection.Close();
dataAD.Dispose();
conn.Dispose();
select.Dispose();
return mds;
}

Is it a good solution to try deleting the .ldb file before each database call?

One more thing. The database is on a Novell Server and I heard that
sometimes windows and Novell doesn't communicate to well and that perhaps
Novell never gets the message that the database is closed. Is this possible
and if so, what could be the workaround?

/Miro
"Robbe Morris [C# MVP]" wrote:
Access is not a good fit for web applications. I've seen your
error occur often times when you don't properly close
the connection "in every instance" and the lock file
gets left.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net

"Miro" <Mi**@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
I've read a couple of threads on this error but none of them could help me
so
I'm posting myself.

When I try open and read (not update) an ACCESS database on a network
share
I occasionally get:

"Could not use ''; file already in use." error.

This always happens when the database is open but sometimes even when it's
not. Not manually anyway. I consequently use DataAdapter.Fill() method
which
should close the connection, right? Anyway, It must work even when the
database is open (not design mode). It does so when I run the application
against a database on the webbserver. What's the difference when its on a
network share? The IUSR has full rights on the database-folder. And as I
said
earlier it works, but not always so it's unlikely a basic security
problem.
There must be some way to force ASP.NET to read an open database. Can
anybody
please help me?

/Miro


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Koen | last post by:
Hi all, I created a little database to manage my e-books. The program will synchronize a table with the contents of a directory. Works great. Because I keep additional info (like keywords) to...
3
by: Ney André de Mello Zunino | last post by:
Hello. I would appreciate if somebody could assist me with an error message I am getting from the Microsoft WinDbg 6.3 debugging tool. I am not familiar with it, since I have just downloaded it....
10
by: M K | last post by:
I get the message: 'Could not use ''; file already in use.' on my pages if I am working in the database. I used to be able work in the database (Access) and users use the site, but I tried to...
1
by: yma | last post by:
Hi, I tried to use a listbox to display a column in MS Access 2000 nwind.mdb by using ole DataAdapter, Connection and dataset controls. But I got "It is already opened exclusively by another...
4
by: Jim | last post by:
Hello, I would like to find every occurrence of the string "://" in the index.dat files which store the ie history. Once a line is identified as containing this string, I would process (i.e....
2
by: Bob | last post by:
Cannot copy assembly '<...>' to file <...>.dll'. The process cannot access the file because it is being used by another process. Could not copy temporary files to the output directory. The file...
6
by: Learner | last post by:
Hi there, I am trying to access the access database sitting at OleDbConnection oleConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Program Files\\Microsoft Visual...
4
by: thinktwice | last post by:
i have just made a test project :(win32 console) //file : func.h #ifndef _FUNC_H_ #define _FUNC_H_ void func1() { return; };
0
by: Andy | last post by:
Thanks Peter, I thought I'd give an update on this problem. My application had 2 assemblies that contained classed for the Data access and business logic layer. It was on one of them that I was...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.