Reputation: 1
I have created a project in visual studio, that uses a database to store and retrieve details.
I want to deliver an executable and just let the user know that he has to place the database file on the desktop.
if i do
String myDesktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
it looks like i cant set the database position after like this:
using (SqlCeConnection cn = new SqlCeConnection(@"Data Source = myDesktop\Database1.sdf))
Any help?
Upvotes: 0
Views: 101
Reputation: 216353
Form a correct path using the Path.Combine method of the Path class
string conString = "Data Source=" + Path.Combine(myDesktop, "Database1.sdf;");
using (SqlCeConnection cn = new SqlCeConnection(conString))
Upvotes: 1