我試圖運行以數據庫爲中心的NUnit的單元測試。測試只是訪問localdb,但NUnit不斷給出錯誤。我建立了一個localdb(或者我認爲),但是sql命令不能識別它。使用Visual Studio和NUnit連接到localdb
Exception occurred while deleting from table: 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. The specified LocalDB instance does not exist.
這裏是在單元測試SQL命令的路徑:
private const string ConnectionString_ = "Data Source=(localdb)\\Projects;Initial Catalog=MetricsBusDatabase;Integrated Security=SSPI;";
我已經讀了大部分的相關SQL的問題,我目前正在重新安裝SQL服務器。似乎沒有人得到同樣的錯誤。我懷疑我錯過了一件非常簡單的事情。