SQLCe local db in temp- path in connectionstring?

Posted by Petr on Stack Overflow See other posts from Stack Overflow or by Petr
Published on 2009-10-26T08:11:58Z Indexed on 2010/05/23 2:00 UTC
Read the original article Hit count: 213

Hi, I have SQL Ce db in my app, which is included in my app directory. While debugging its OK, but when published and run with setup.exe, it retrieves "file not found" in temporary directory the app is ran from. I would like to run from standard location, but I dont know how to change it.

I am using this string:

SqlCeConnection connection = new SqlCeConnection("Data Source=database.sdf;Persist Security Info=False;");

When I run setup.exe, the app never starts, stating that in its temporary directory the db file was not found. When I run app.exe, it works. I do not understand it...:(

EDIT: I can see that in the VS project settings, there is connection string and there is "Data Source=|DataDirectory|\Database.sdf"

The path should be something like local directory? Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql-server-ce