Connecting Tech Pros Worldwide Help | Site Map

The process cannot access the file because it is being used by another process.

Newbie
 
Join Date: Jan 2009
Posts: 2
#1: Jan 26 '09
hello programmers..,

i am trying to use excel file in code which contains students data.
i tried to upload excel file in ASP.NET. and it worked fine for first time but for second time it gives me an error

"The process cannot access the file because it is being used by another process."

i am stuck on this can anyone know the solution to this.

i am using office 2003.
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,603
#2: Jan 26 '09

re: The process cannot access the file because it is being used by another process.


It sounds like you never closed your stream. Make sure you do that.
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#3: Jan 26 '09

re: The process cannot access the file because it is being used by another process.


Also make sure you call the the Dispose() method when you are finished with the file to release the resource.
Newbie
 
Join Date: Jan 2009
Posts: 2
#4: Jan 26 '09

re: The process cannot access the file because it is being used by another process.


i have released all connections already.....
still its not working....
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,603
#5: Jan 26 '09

re: The process cannot access the file because it is being used by another process.


Well, load up process explorer and find out what has a lock on your file.

We really can't tell anything until you post some code for us. We can't tell you what's going wrong without seeing anything.
Reply