林面臨着在Windows應用程序數據庫連接C#數據庫連接的問題...這裏是我的連接,,, PC2是PCNAmeWindows應用程序的數據庫連接C#
private static SqlConnection con = new SqlConnection(
"Data Source=PC2\\SQLEXPRESS; Initial Catalog=Database1;Integrated Security=True"
);
當我運行的形式,我得到這個未處理的異常on con.Open();
SQLEXCEPTION被unhandeled:
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)
希望有人能幫助我試着去解決它幾個小時,但沒有工作。 MSDN上
[請確保您的數據庫引擎已配置爲接受遠程連接](http://www.sswug.org/articlesection/default.aspx?TargetID=44331) – Habib 2012-07-16 11:06:56
您配置了SQLExpress接受遠程連接嗎? http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx – 2012-07-16 11:07:29
1.您是否安裝了sql server,2.您可以使用sqlcmd登錄嗎? 3.是運行的sql服務器 – 2012-07-16 11:07:37