1

I'm having trouble accessing my sqlite database after I install the program with InstallShield. I have the database referenced in the app.config file like shown below

<add name ="Database" providerName="System.Data.Sqlite" connectionString="Data Source =|DataDirectory|CKDatabase.db"/> 

this is referenced by my c# code like shown below

string connectionStringCKDatabase = System.Configuration.ConfigurationManager.ConnectionStrings["Database"].ConnectionString; 

When I install the program the database is included with the reference libraries and the application, but when I logon the error says "unable to open database file". The database doesn't have to be buried somewhere complex. It's just a simple reference. Obviously it works fine in regular debug mode. I know this is an easy question but I feel performing an install has very few resources for learning.

1
  • You're absolutely right! I installed it on the C: drive and it worked. Thanks a bunch. I'll mark it as answered as soon as it lets me. Commented Nov 1, 2015 at 23:24

1 Answer 1

1

You have a permission problem. |DataDirectory| in desktop applications is the same folder where you have installed the application and if this is "Program Files" you usually don't have write permission there. Try to temporary set the permission read/write to everyone on that folder. If this solves the problem then study how to deploy your database file in a folder where you have read/write permissions like ProgramData

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.