2011-07-23 180 views
0

我按在添加数据库浏览器连接然后把服务器名称是Rabbitmasterpc问题数据库连接到Visual Studio 2010

Windows身份验证,附加数据库文件: - >我浏览到我连接数据库。 。给它一个合乎逻辑的名字。点击“确定”。而我得到:

"A network-related or instance specific error occured while establishing a connection to SQL Server. The server was not found or was not accessable. Verify that the instance name is correct and that SQL Server is configured to allow removte connections. (provider: Named Pipes Provider, error:40- Could not open a connection to SQL server)"

UPDATE:

http://www.mssqltips.com/tip.asp?tip=1673 

文章说,这是在facets..but我没有这里面

回答

0

检查配置SQL服务器(通过SQL Server的配置管理器)接受远程连接。

此外,您可能需要检查连接属性页在Management Studio数据库,以及防火墙设置: http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx

+0

嗯......我该怎么做。我有数据库连接到SQL Server 2008 ..它不出现在Visual Studio 2010中的SQL服务器部分。:( –

+0

@Dmitry Makovetskiyd你有权访问安装SQL Server的机器吗? – prusswan

+0

配置表面区域配置SQL Server 2008 ---我试图在SQL Server 2008中找到它 –

0

尝试使用下面的代码打开连接。

Try 
     Dim objconnection As SqlConnection = New _ 
      SqlConnection("Server=localhost;Database=DATABASENAME;" & _ 
          "user ID = YOURUSERID; password = YOURPASSWORD;") 

     objconnection.Open() 
     objconnection.Close() 

     MessageBox.Show("Database Connection Success") 
Catch ex As Exception 
     MessageBox.Show("Database Connection Error: " & ex.Message) 
End Try 
相关问题