473,396 Members | 2,093 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,396 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 9450
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.