hi
i have a program that i use to write data to an excel file....and at the same time i use an excel file to import data from the first excel file using (import data) tool
this is part of the program code
[code]
StreamWriter theString = new
StreamWriter(FileName + ".csv", true);
theString.WriteLine(DateTime.Now +
dataToSave + "\t\n");
theString.Close();
[/code]
my problem is when i start to debuge my program in Visual C# 2008
it will work will and start to write data to the first excel file....then during the debug process
i want to import data from the first excel file to the second one using import data(it's important for me to do that in real time i cant delay the import process)
the debuging process stopped and the visual C# 2008 higlight this line of the code
[code]
theString.Close();
[/code]
and a message popup to me said
The process cannot access the file because another process has locked a portion of the file.
any help in overcome this problem plz
and thanks
Loading
krishna vPosted Sep 11, 2010, 9:58 PM
Sam HobbsPosted Sep 9, 2010, 6:53 PM
Manikavelu VelayuthamPosted Sep 9, 2010, 6:45 AM
In case if the file is opened in your machine during debugging, it will throw the error like that.
In case in your program, you are accessing the same file in two different area, it will throw the error like that
So try to avoid the above scenarios and continue your functionality.
Surely it would work.