Error opening streamreader because file is used by another process

Posted by Geri Langlois on Stack Overflow See other posts from Stack Overflow or by Geri Langlois
Published on 2010-04-28T14:54:33Z Indexed on 2010/04/28 15:13 UTC
Read the original article Hit count: 295

Filed under:
|
|

I am developing an application to read an excel spreadsheet, validate the data and then map it to a sql table. The process is to read the file via a streamreader, validate the data, manually make corrections to the excel spreadsheet, validate again -- repeat this process until all data validates.

If the excel spreadsheet is open, then when I attempt to read the data via a streamreader I get an error, "The process cannot access the file ... because it is being used by another process." Is there a way to remove the lock or otherwise read the data into a streamreader without having to open and close excel each time?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about locking