简体   繁体   English

'System.Data.SQLite'锁定了数据库文件'

[英]'The database file is locked' with System.Data.SQLite

I am suddenly getting the following errors from SQLite after adding a new transaction: 添加新事务后,我突然从SQLite收到以下错误:

The database file is locked database is locked 数据库文件被锁定数据库被锁定

Has anyone seen this? 有没有人见过这个? I added an update transaction (following some successful selects/inserts). 我添加了一个更新事务(在一些成功的选择/插入之后)。 I can't find anything different about this one... 我找不到关于这个的任何不同......

I figured it out. 我想到了。 From looking at this [really old] thread on the phxsoftware site, it seems like there can be locking problems if you don't immediately dispose of readers and commands after executing them. 通过查看phxsoftware网站上的这个 [真的很老]线程,如果在执行它们之后没有立即处理读取器和命令,似乎可能存在锁定问题。

I fixed my problem by making sure to not keep commands or readers around and surrounding them with using statements. 我通过确保不使用语句保持命令或读者并围绕它们来解决我的问题。

( Web archived version of the link ) 链接的Web存档版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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