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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -