Click here to Skip to main content
15,941,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have an application in windowsforms. in that the app there are few links whose paths come from access database. depending upon the link clicked the corresponding application opens. there a different applications in the paths like .txt files .xls files and mdb file etc. the problem is when i click on link of mdb file it opens for 1st time correctly.without closing the opened mdb when i open it 2nd time its giving a error like this"'System.ComponentModel.Win32Exception' occurred in System.dll".and it is happening only with mdb files. why is this happening.cant i open the mdb file twice using process.start?

1 solution

It's not a Process.Start problem, it's that whatever application you have set as the default for MDB files is holding exclusive access to the file - which makes sense, and MDB files are pretty rubbish when used in a multiuser environment, unless packaged by something like SQL server.

The first time you open it with Process.Start the application runs, opens the file, and holds on to it with an exclusive lock to prevent other programs changing it while it is using it. When you then try to use Process.Start on the same file, the same program runs again, tries to open the file, and fails because it is in use.
Share this answer
ssskp32 29-Aug-12 2:25am    
so can you please tell me what is the solution for it?
OriginalGriff 29-Aug-12 2:29am    
There isn't one - except to change the application to one that doesn't take an exclusive lock. Which is going to be difficult to find, depending on what you need it to do with the MDB file in the first place.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900