ConnectionString问题 [英] ConnectionString Problem

查看:65
本文介绍了ConnectionString问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个C#MVC 4.0应用程序,我需要连接到位于网络驱动器上的SDF(SqlCe 4.0)文件。我使用以下连接字符串:

I've created a C# MVC 4.0 app and I need to connect to a SDF (SqlCe 4.0) file located on a network drive. I am using the following connection string:

_sqlcon.ConnectionString =" Data Source = \\SERVERNAME \\DATABASES \\Database1.sdf; Persist Security Info = False; password = xxxxxxx" ;;

_sqlcon.ConnectionString = "Data Source= \\SERVERNAME\\DATABASES\\Database1.sdf;Persist Security Info=False;password=xxxxxxx";

当前代码进入_sqlcon.Open()命令时,抛出以下异常:

The moment code goes into the _sqlcon.Open() command, the following exception is thrown:

路径无效。检查数据库的目录。 [路径=  \ SERVERNAME \ DATABASES \Database1.sdf  ]

The path is not valid. Check the directory for the database. [ Path = \SERVERNAME\DATABASES\Database1.sdf ]

有人可以建议我如何访问数据库吗?我不想将SDF文件移动到app_data或我的应用程序中的任何文件夹中。我想直接从网络路径访问它。

Can someone please suggest how I can access the database? I don't want to move the SDF file into app_data or any folder within my application. I want to access it directly from the network path.

谢谢,

FS

推荐答案

请参阅我的帖子:

Please refer to my post here:

https://jqueryninja.wordpress.com/2011/01/10/how-do-i-get- the-connection-string /

 

Noam B。


这篇关于ConnectionString问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆