pls3399
pls3399

Reputation: 53

Cannot access SQL Server CE DB after installation

I have created a Winforms app that writes all data to a SQL Server CE database. I am able to successfully install the app but when I try to read or write data, it tells me that it cannot open the connection. This only happens on PC's other than the one I created the program on. Nothing is hardcoded.

Does anyone have any suggestions?

Thank you

Upvotes: 1

Views: 171

Answers (1)

LarsTech
LarsTech

Reputation: 81610

Windows will fight you with permission issues for locating the database in the Program Files directory. It doesn't belong there.

Consider moving the database to your own folder in this root folder:

Environment.SpecialFolder.ApplicationData

Obviously, the connection string needs to reflect that folder path.

Upvotes: 1

Related Questions