Hi,
Can someone please help me.
I am getting error: The process cannot access the file 'c:\reports\PaymentDetailReport.xml' because it is being used by another process. in following function.
This method is suppose to be called couple of times. but at second time, it throws the error. I have even closed tw.
visit www.sysinternals.com and find filemon utility - you can monitor any filesystem activity and find what is wrong. You can download handle.exe utility (commandline) to find snapshot of opened files as well.
StreamWriter tw = new StreamWriter(_documentName);
If I'm not mistaken tw is a filehandle. If you forget to say [icode=c#]tw.Close()[/icode] tw is never closed and you forgot to close a filehandle. This isn't done til you exit your application (though I might be mistaken).
StreamWriter tw = new StreamWriter(_documentName);
If I'm not mistaken tw is a filehandle. If you forget to say [icode=c#]tw.Close()[/icode] tw is never closed and you forgot to close a filehandle. This isn't done til you exit your application (though I might be mistaken).
well as you see in my example, i have used tw.close(); The second last line.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.