简体   繁体   中英

“The process cannot access the file” error in Winforms in C#

I made an .sdf file (SQL CE) from an XML file. When the file is ready, I want to attach it to an e-mail. But when I try to attach it, I get this error:

The process cannot access the file......because it is being used by another process

How can I fix it?

Do you have an SqlCeConnection open on the file? Is it open in Visual Studio?

I suggest you use Process Explorer so you can identify the process which has a handle on it.

我猜想是因为SQLCE数据库随程序一起在过程中运行,所以在程序运行时无法独占访问文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM