我將在Visual Studio 2012(C#)中創建一個SQL Server數據庫文件(.MDF
文件)。winform應用程序中的SQL Server連接字符串
我工作的桌面應用程序,我添加了一個新的.MDF
文件的項目,但我不知道什麼是我的連接字符串,我得到這個錯誤,當我嘗試連接到我的DB:
SqlConnection SQLConnection = new SqlConnection("Data Source=db\\ofoghdb.mdf");
SQLConnection.Open();
錯誤:
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: 26 - Error Locating Server/Instance Specified)
我相當熟悉web開發SQL Server中,但我要在桌面(WinForm的)應用程序來使用它,我得到上述錯誤
有此錯誤的幾個原因。 http://www.sswug.org/articlesection/default.aspx?TargetID=44331 – 2013-04-24 08:43:05