sql connection string problem

Geo*_*rge 5 .net c# sql compact-framework windows-mobile

I have Database (compact sql server) in a*.sdf file. I converted a compact framework project to a regular pc project and for some reason, with the same code, and the same*.sdf file the following exception was thrown: "the file name is not valid. check the file name for the database"

the weird thing is that on my Pc - the substring "file:\" was added to my original connection string and that's probably why the exception is thrown. when I remove the "file:\" substring during debug mode, on runtime, the exception is not thrown.

why was this substring added? where does it come from? and how can I solve this problem?

最近我发现可能与app.config文件丢失有关.这仍然没有解释原始连接字符串是如何存在的,只是它添加了子字符串.

请帮忙.提前致谢

C.E*_*uis 0

由于 Windows CE 没有“当前目录”,因此实现通常将当前运行的程序集的位置作为要查找的目录。在桌面上,返回的字符串包括Assembly.GetExecutingAssembly().GetName().CodeBase该方案前缀。