Hi all,
I have a problem while deleting xml File.
In detail i have generated xml file with encrypted format.
now when i am importing this file with decryption all data read and inserted to database using dataset. Record inserted successfully but when all process completed i want to delete the decrypted file using
system.IO.file.delete(strpath);
it can't be deleted shows error message file is used by another process.
Can anybody help me its urgent..

Thanks in advance..

Recommended Answers

All 3 Replies

That means that this file is opened. An because it is opened, it means that it is used by another process.
You will have to close it down, and then you can do (execute) your code.
Check doube times if file is in use or not (but I am sure it is in use atm).

check all the programs that are supposed to use the particular XML file

I guess so you have used FileStream for reading the XML file. If so, Close that Filestream..

Filestreamobject.Close();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.