Could Not Lock File

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

Guest

I am playing with an ASP.NET Web App and an Access Database. In my code, I
am trying to open a connection called cnTest. I created it by dragging it
onto my app and setting the connection string. I am trying to open the
connection before I create a data reader. I receive ExecuteReader requires
an open and available connection. I put a Try Catch in for the cnTest.Open,
and the catch portion I use to generate the error in a label on the form.
The error says 5 - Could not lock file.

My connection string is "Provider=Microsoft.JET.OLEDB.4.0;Data
Source=c:\test.mdb"

After I get the error, I check the string again, and it is some really long
connection string instead of the one I set.

Help.
 
¤ I am playing with an ASP.NET Web App and an Access Database. In my code, I
¤ am trying to open a connection called cnTest. I created it by dragging it
¤ onto my app and setting the connection string. I am trying to open the
¤ connection before I create a data reader. I receive ExecuteReader requires
¤ an open and available connection. I put a Try Catch in for the cnTest.Open,
¤ and the catch portion I use to generate the error in a label on the form.
¤ The error says 5 - Could not lock file.
¤
¤ My connection string is "Provider=Microsoft.JET.OLEDB.4.0;Data
¤ Source=c:\test.mdb"
¤
¤ After I get the error, I check the string again, and it is some really long
¤ connection string instead of the one I set.

You're probably experiencing a file permissions issue. See if the following helps:

http://support.microsoft.com/default.aspx?scid=kb;en-us;316675


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top