关键'attachdbfilename“ASP.NET值无效 [英] ASP.NET Invalid value for key 'attachdbfilename'

查看:1152
本文介绍了关键'attachdbfilename“ASP.NET值无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下一个错误弹出,当我初始化的SqlConnection 对象:

The next error pops when I initialize the SqlConnection object:

重点'attachdbfilename'值无效。

我试图来解决这个问题了几个小时(也试过任何建议我能找到的SO),但没有成功。

I have tried to solve this issue for hours (Also tried any of the advices I could find on SO), but with no success.

这是我的连接字符串:

Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|Users.mdf;Integrated Security=True

Users.mdf 位于的App_Data 文件夹中。

我使用Visual Studio 2012旗舰版,.NET版本是4.5,与SQL Server 2012。
这个问题开始后,我格式化我的主要驱动器,并安装我上面提到的软件。

I am using Visual Studio 2012 Ultimate, .NET is Ver 4.5, with SQL Server 2012. This issue started after I formatted my main driver, and installed the software I mentioned above.

谢谢,盖伊

推荐答案

这似乎是为SQL Server防爆preSS版的连接字符串。

That seems to be a connection string for SQL Server Express edition.

你有恩preSS版安装开发机器上?

Do you have express edition installed on Dev machine?

我面临着同样的问题,唯一的解决方法是创建一个名为数据库用户在SQL Server中的非防爆preSS版。

I faced the same issue and only workaround was to create a database named Users in non-express edition of SQL Server.

假设你已经安装了非防爆preSS版,您需要将现有的 Users.mdf 附加到SQL服务器作为数据库。
http://www.sqlservercentral.com/Forums/Topic590254-360-1.aspx

Assuming that you have non-express edition installed, you need to attach the existing Users.mdf to SQL server as a database. http://www.sqlservercentral.com/Forums/Topic590254-360-1.aspx

连接字符串:
服务器=本地主机;数据库= NewDatabaseName;用户ID =名为myUsername;密码= MYPASSWORD;

Connection string: Server=localhost;Database=NewDatabaseName;User Id=myUsername;Password=myPassword;

http://www.connectionstrings.com/sql-server-2008

这篇关于关键'attachdbfilename“ASP.NET值无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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