2015-06-13 113 views
0

我需要在Visual Studio中使用SQL Server的幫助。我似乎無法將我的Visual Studio與內部SQL服務器連接起來。我創造了與Visual Studio數據庫更早,它工作正常,但現在我得到一個錯誤說:SQL server&Visual Studio

The attempt to attach to the database failed with the following information: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.

我試圖在一個新的項目,以創建一個新的數據庫文件,但後來我得到的錯誤:

A network related or instance specific error occurred while establishing a connection. The server was not found or was not accessible. (Provider:Named Pipes Provider, error:40- could not open a connection to SQL server.

我已經嘗試過不同的事情,但似乎無法得到問題的竅門。我也重新安裝了視覺工作室,但那也沒用。我能做些什麼來擺脫這個錯誤並讓我的數據庫恢復在線?

回答

0

如果您在本地計算機上運行Visual Studio,那麼您在防火牆和啓用TCP/IP方面沒有任何問題。

試試這四種解決方案可以解決您的問題:

  1. 的SQL Server Express的LocalDB附加,從this鏈接得到它。
  2. 請確保您的SQL service is running
  3. 使用SQL Server身份驗證。
  4. 確保您在添加連接窗口的服務器名稱中鍵入.\sqlexpress。您應該使用反斜槓\作爲分隔符,而不是正斜槓。