Could not use ''; file already in use

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
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.
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top