我正在阅读一本教自己ASP.NET的书。到目前为止,它很好,甚至在SQL Developer中的SQL,但我无法从外部应用程序连接。ASP.NET中Microsoft SQL Server 2008 R2的连接字符串
我正在使用Visual Studio 2010 Pro SP1,SQL Server 2008 R2标准和使用IIS 7.5的Windows 7 Professional SP1。我在ASP.NET中使用的语言是VB.NET但很高兴为C#答案。
我永远无法得到的连接字符串工作
connectionString="Server=ASUS-P5Q\MSSQLSERVER;Database=Dorknozzle; User Id=xxxxxxxxx; Password=xxxxxxxxx;"
我总是碰到下面的错误
Server Error in '/' Application.
Login failed for user 'ASUS-P5Q\xxxxxx'.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'ASUS-P5Q\xxxxxxx'.
Source Error:
Line 17: conn.Open()**
我关闭用户帐户控制,防病毒和防火墙,但没有作品:-(
为什么'华硕P5Q \ MSSQLSERVER'?你尝试过简单的'localhost:port'吗? (因为我猜你试图从同一台机器连接) – walther
你可以使用Sql Server Management Studio连接到该服务器/数据库/用户/传递组合吗?或者使用命令行获得结果:'sqlcmd -S ASUS-P5Q \ MSSQLSERVER -d Dorknozzle -U xxx -P xxx -Q“select * from table”'? –
您是否安装了带有特定命名实例的SQL Server - 或者只是标准的默认实例?如果你使用了默认的实例,那么你应该可以在你的连接字符串中将'.','(local)'或'ASUS-P5Q'作为实例名称。不需要'MSSQLSERVER' ....所以试试看:'server = ASUS-P5Q; Database = ....'看看是否有效 –