File is used by another process?
Posted
by Surya sasidhar
on Stack Overflow
See other posts from Stack Overflow
or by Surya sasidhar
Published on 2010-01-30T04:34:14Z
Indexed on
2010/05/06
12:08 UTC
Read the original article
Hit count: 180
ASP.NET
I get this error (file is being used by another process). Actually I write the code in a button click event like this, i am saving the excel file in a file using file upload, immediately i am fetching the file which i was save just now there i am getting this error. in my point of view i think it take time to save the excel file in that file. this is my code:
FileUpload1.PostedFile.SaveAs(Server.MapPath("~/User/Excel/" + name.ToString() + ".xls"));
string s = Server.MapPath("~/user/excel/" + name.ToString() + ".xls");
OleDbConnection DBConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + s.ToString() + ";" + "Extended Properties=\"Excel 8.0;HDR=Yes\"");
DBConnection.Open();
string SQLString = "SELECT * FROM Contacts";
OleDbCommand DBCommand = new OleDbCommand(SQLString, DBConnection);
IDataReader DBReader = DBCommand.ExecuteReader();
mygridOut.DataSource = DBReader;
mygridOut.DataBind();
and i am getting error like this:
because it is being used by another process.
© Stack Overflow or respective owner