Afnan Bashir
Afnan Bashir

Reputation: 7429

Unable to write to database

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

Upvotes: 0

Views: 4853

Answers (3)

David Sykes
David Sykes

Reputation: 49882

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

Upvotes: 1

OnesimusUnbound
OnesimusUnbound

Reputation: 2946

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#

Upvotes: 2

Related Questions