I am struggling with how to make my app work when deployed - it keeps saying the file is invalid no matter what I do: What I have now is:
Data Source="\MyDb.sdf"
The DB should be in the directory where the executable is located.
You probably need to use an absolute path to access the file.
var pathToExe = System.Reflection.Assembly.GetExecutingAssembly().Location;
var path = Path.GetDirectoryName(pathToExe);
var pathToDb = Path.Combine(path, "MyDb.sdf");
pathToDb should now be an absolute path to your database object, assuming it is always in the directory of the executing assembly.
MyDb.sdf explicitly exists in the path?XX.exe.
MyDb.sdfexist in the application directory?