无法写入数据库
你好呀 我开发了一个使用 SQLlite 数据库的应用程序,但是在创建安装项目并安装它之后,我在写入它时遇到异常,
System.Data.SQLite.SQLiteException: Attempt to write a read-only database
问题是什么?
在视觉工作室开发时它工作正常
编辑 我添加了用户Everyone,并将其分配给放置数据库的文件夹的所有权限。该文件夹是由安装程序创建的,现在可以使用,但是我应该做什么来避免这种情况..........因为这个文件夹在哪里将部署应用程序,他们不太懂计算机,无法手动执行此操作
Hi there
I developed an applicaiton that uses SQLlite database but after making setup project and installing it i get exceptions when writing to it
System.Data.SQLite.SQLiteException: Attempt to write a read-only database
what is the problem?
it works fine while developing at visual studio
EDIT
I added user Everyone and assigned it all rights to the folder where the database is placed.that folder was created by the installer and it worked now but what should I do to avoid this ..........because where this application will be deployed they are not much computer literate to do this manually
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在链接论坛中,常见的根本原因是权限问题。
http://sqlite.phxsoftware.com/forums/p/864/7498。 aspx
更新
为什么不加密sqlite数据库
用C#加密SQLite数据库
In the link forum, the common root cause is permission issue.
http://sqlite.phxsoftware.com/forums/p/864/7498.aspx
Update
Why not encrypt the sqlite database
Encrypt SQLite database in C#
尝试写入只读数据库 - System.Data .SQLite
Attempt to write a read-only database - System.Data.SQLite
数据库不应与 exe 文件位于同一文件夹中。出于安全原因,exe 文件(即程序文件)的位置受到保护,修改权限并不是可行的方法。
您应该将需要写入的数据放在用户数据区,或者所有用户的数据区。
您可以使用 SHGetSpecialFolderPath 找到此文件夹
The database should not be in the same folder as the exe file. The location of exe files, i.e. program files, is protected for security reasons, and modifying the permissions is not the way to go.
You should put data that needs to be written to in the users data area, or the data area for all users.
You can locate this folder using SHGetSpecialFolderPath