I load data from sdf database in winforms App. I use full path to the database file . Example :
conn = new SqlCeConnection { ConnectionString =\"Data Sou
Would you please try with below code block, which is exactly what you're looking for:
SqlConnection conn = new SqlConnection { ConnectionString = "Data Source=" + System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\Database.sdf" };