purdyra1
asked on
Why??? process cannot access the file because it is being used by another process
I have a web app I am running. all of my other web pages work just fine and access the database just fine. but when I click on a new page I get this error. I can then go out and access other pages that access db just fine again.
I must add, the other pages use regular data calls, but this 'problem' page is using Linq.
I look in the sql log and see:
2010-04-20 18:03:28.90 Logon Login failed for user 'WORKLAPTOP\username'. [CLIENT: <named pipe>]
2010-04-20 18:04:13.53 spid51 Error: 17207, Severity: 16, State: 1.
2010-04-20 18:04:13.53 spid51 FCB::Open: Operating system error 32(The process cannot access the file because it is being used by another process.) occurred while creating or opening file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ db1.mdf'. Diagnose and correct the operating system error, and retry the operation.
I did go into my:
C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
and delete everything and restart.
thx.
I must add, the other pages use regular data calls, but this 'problem' page is using Linq.
I look in the sql log and see:
2010-04-20 18:03:28.90 Logon Login failed for user 'WORKLAPTOP\username'. [CLIENT: <named pipe>]
2010-04-20 18:04:13.53 spid51 Error: 17207, Severity: 16, State: 1.
2010-04-20 18:04:13.53 spid51 FCB::Open: Operating system error 32(The process cannot access the file because it is being used by another process.) occurred while creating or opening file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
I did go into my:
C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
and delete everything and restart.
thx.
Please post your connection string. I suspect you are trying to attach the database as opposed to merely opening it.
On second thoughts, does the default database for cpuname\username exist? If not change it to a database that does exist, Master for example.
ASKER
since I am using a sourcesafe I have to share the .mdf with the rest of the team, so I do have to keep attaching and detaching the mdf to check it in. the default db was the db that we are using and I thought, well maybe behind the scenes this is causing problems, so I made the default db for the cpuname\username the Master Db, this way if I detach the db we are using it doesn't cause problems.
so to answer your question, the default db is Master.
so to answer your question, the default db is Master.
ASKER
I was told that linq doesn't look at the app.config file where the other connection string is. it has the same values either way.
this is from the Settings.settings file.
here is the connection string:
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="e xample1.Co re.Propert ies" GeneratedClassName="Settin gs">
<Profiles />
<Settings>
<Setting Name="example1ConnectionSt ring" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
<SerializableConnectionStr ing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ConnectionString>Data Source=.\SQLEXPRESS;Attach DbFilename ="C:\Progr am Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ example1.m df";Integr ated Security=True;User Instance=True</ConnectionS tring>
<ProviderName>System.Data. SqlClient< /ProviderN ame>
</SerializableConnectionSt ring></Des ignTimeVal ue>
<Value Profile="(Default)">Data Source=.\SQLEXPRESS;Attach DbFilename ="C:\Progr am Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ example1.m df";Integr ated Security=True;User Instance=True</Value>
</Setting>
</Settings>
</SettingsFile>
this is from the Settings.settings file.
here is the connection string:
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
<Profiles />
<Settings>
<Setting Name="example1ConnectionSt
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
<SerializableConnectionStr
<ConnectionString>Data Source=.\SQLEXPRESS;Attach
<ProviderName>System.Data.
</SerializableConnectionSt
<Value Profile="(Default)">Data Source=.\SQLEXPRESS;Attach
</Setting>
</Settings>
</SettingsFile>
ASKER
whoops, one of my examples above says db1.mdf, and the other has example1.mdf.
I obviously am just replacing the real name of the db to something I am making up. they should be the same and in my code they are. so ignore this oversight.
I obviously am just replacing the real name of the db to something I am making up. they should be the same and in my code they are. so ignore this oversight.
>>since I am using a sourcesafe I have to share the .mdf with the rest of the team, so I do have to keep attaching and detaching the mdf to check it in.<<
Then that is your problem. There is simply no need to do that. I am surprised you have not corrupted the database yet.
Then that is your problem. There is simply no need to do that. I am surprised you have not corrupted the database yet.
ASKER
why does it work for the rest of our web pages except for this one page? besides the fact the others don't use Linq and this one does?
we are all working remotely on our machines at our homes, and due to the situation we have to have a local install of the .mdf file.
I have to download the changes to the .mdf from the other users, and to do that, I must detach the db or it won't let me download a file becz it's in use.
any other workarounds?
and I keep thinking to myself, it works just fine with the other pages just fine, except for this one page that uses Linq.
we are all working remotely on our machines at our homes, and due to the situation we have to have a local install of the .mdf file.
I have to download the changes to the .mdf from the other users, and to do that, I must detach the db or it won't let me download a file becz it's in use.
any other workarounds?
and I keep thinking to myself, it works just fine with the other pages just fine, except for this one page that uses Linq.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
[0] = {System.Data.SqlClient.Sql
[1] = {System.Data.SqlClient.Sql