c# - Why SQL Server CE does not recognize DB when my app is deployed -


i struggling how make app work when deployed - keeps saying file invalid no matter do: have is:

data source="\mydb.sdf"

the db should in directory executable located.

you need use absolute path access file.

var pathtoexe = system.reflection.assembly.getexecutingassembly().location; var path = path.getdirectoryname(pathtoexe); var pathtodb = path.combine(path, "mydb.sdf"); 

pathtodb should absolute path database object, assuming in directory of executing assembly.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -