|
-
Jan 21st, 2010, 12:43 AM
#1
Thread Starter
Lively Member
Could not lock file - I'm stumped
I've searched high and low for an answer so I'm hoping someone can help me out and I hope I explain what is happening ok. I have a number of people testing an application and one of them in particular is running into this error repeatedly. The error does not happen on my machine or almost any other. I know it is in relation to database usage but what I can't figure out is why the user only gets the error after the database has been called x number of times (and closed each time its done being used) as opposed to why the program doesn't crash the first time the database file is accessed.
The database is in MS Access and here's some pertinent info from the code - and the error is not subject to any particular database call...it just seems that after so many hits to the database its had enough and it crashes.
First, the error
System.Runtime.InteropServices.COMException (0x800A0BEA): Could not lock file.
at dao.DBEngineClass.OpenDatabase(String Name, Object Options, Object ReadOnly, Object Connect)
Second, a typical database call
sFileLoaded = My.Application.Info.DirectoryPath & "\file.dat" (database file was renamed from .mdb to .dat outside of the application)db = DAODBEngine_definst.OpenDatabase(sFileLoaded)
and in a separate module the following is declared
Friend DAODBEngine_definst As New dao.DBEngine
Third, other info
- the database is closed each and every time its used with db.close
- immediately after it is closed I have
System.Runtime.InteropServices.Marshal.ReleaseComObject(db)
Like I said, why would the code work on almost all other machines (he's got a newer machine too and has tried both XP and Vista machines) and if there is something about his system why does is successfully call and use the database for awhile but then crashes out seemingly after a certain number of uses of the database file? I know it is not a specific call to the database because the area the application typically crashes for him at can be bypassed by changing some of the options available to the user - when he cuts back on the options used the program simply crashes at a later point in the process.
Thank you to anyone with an idea or two to try out here.
-
Jan 21st, 2010, 07:24 AM
#2
Hyperactive Member
Re: Could not lock file - I'm stumped
Does this user have write permission for the directory this access database file is located in?
The application needs to write/create a lock file there.
-
Jan 21st, 2010, 08:09 AM
#3
Thread Starter
Lively Member
Re: Could not lock file - I'm stumped
 Originally Posted by gonzalioz
Does this user have write permission for the directory this access database file is located in?
The application needs to write/create a lock file there.
Yes because the application is able to process calls to the database - it just seems that after a certain number of times doing it then it crashes the program. Like I said, I would understand if it crashed on the first call to the database but it doesn't.
-
Jan 21st, 2010, 08:15 AM
#4
Hyperactive Member
Re: Could not lock file - I'm stumped
Well I thought this was because you unlock the file when your done working with it. So the application will only crash when he and another user are using the file at exactly the same time. When no one is using the file, then the app doesn't create a lock file I think.
Just some stupid ideas, that probaly are ##%$*# :
Maybe the network connection of your user is bad, so it crashes when the networkpath is not avalaible.
Maybe it's a virusscanner that is scanning the file... so he cant access it...
-
Jan 21st, 2010, 08:18 AM
#5
Thread Starter
Lively Member
Re: Could not lock file - I'm stumped
Thanks for the ideas - I'm willing to look at anything. Only a single user is using the database so its only accessing it on his hard drive and not a network.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|