我将在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