2012-10-22 38 views
0

我在win7 32位中安裝了SQL Server 2008 R2和Visual Studio 2010。他們安裝正確。而且每個人都可以獨自行事但是當我想從Visual Studio連接到SQL Server Management Studio時,出現此錯誤。 (我想連接到本地數據庫):SQLException未處理在建立與SQL Server的連接時發生網絡相關或實例特定的錯誤

SQLException was unhandled 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:Named Pipes Provider,error:40-could not open a connection to SQL Server)

這是我連接代碼:

cn = new SqlConnection(); 
cn.ConnectionString = "Data Source=(local); Initial Catalog=XXX_amlak; User ID=sa; password=XXX"; 
cn.Open(); 
+0

安裝了哪個版本的SQL Server。快遞還是標準? –

+0

SQL Server 2008 R2企業版 –

回答

相關問題