简体   繁体   中英

sql connection string problem

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?

recently I discovered that there may some some connection to the fact that the app.config file is missing. This still doesn't explain how the original connection string exists, only with it's added substring.

Please help. thanks in advance

I don't see why you would need "file://". It should work without that just fine. For sure it looks wrong that you have file:\\ instead of file://

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM