2009-04-21 110 views
5

當我轉到Visual Studio 2005中的「添加新項目」窗口並嘗試添加一個SQL數據庫時,它會掛起一點,然後出現以下錯誤:使用Visual Studio創建SQL數據庫並添加到項目

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: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)

我可以使用SQL Server Management Studio連接到localhost(默認實例),但是Visual Studio必須嘗試連接到另一個實例(不再運行)。如何更改嘗試連接的實例以添加和使用數據庫?

回答

3

聽起來好像您可能試圖添加SQL Server Express數據庫的實例,但您可能沒有安裝或打開該服務。

+0

我正在運行SQL Server 2005 Express – 2009-04-21 18:23:11

+0

最大:你肯定服務正在運行嗎? – TheTXI 2009-04-21 18:24:19

+0

我可以連接使用SQL Server Management Studio – 2009-04-21 18:27:11

0

展開服務器節點並刪除舊的服務器。

1

您能解決這個問題嗎?我只花了3個小時來解決同樣的問題,並不能確定解決方案是什麼,但它是有效的。 我的錯誤是當我將Visual Studio升級到數據庫版本時,本地SQL Server實例未運行。 SQLExpress未安裝。

啓動數據庫後,我最初得到的錯誤與您嘗試在Visual Studio中打開現有數據庫項目或創建新數據庫項目時的情況相同。 我搜索了很長時間,嘗試了服務器,實例,主機,別名和其他名稱的設計時間驗證數據庫設置的所有組合,都無濟於事。它不會連接。我甚至重新安裝了Visual Studio,但這也沒有幫助。

我認爲可能做的訣竅是this msdn article中的註釋 - 更改此設置後卸載項目。我最終清除了該字段(對於默認實例),卸載了該項目,重新加載了它,並且violá,我正在開展業務。現在是時候去睡覺了。

相關問題