string folder= System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().CodeBase);
string dbPath = System.IO.Path.Combine(folder, "DbName.sdf");
string connString = "DataSource=" + dbPath;
Then you can use the connString
to open connection to the DB.