PDA

View Full Version : سوال: خطا در اتصال به پایگاه داده



hashemi85sep
جمعه 03 دی 1389, 19:23 عصر
سلام

کی میدونه این خطا مربوط به چیه؟
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

string connectionstring = "Data Source=(localhost); Initial Catalog=Database; Integrated Security=True";
SqlConnection conobj = new SqlConnection(connectionstring);
string commandtext = "insert into Table1(name,family,pic)values ('a','a','a');";
SqlCommand cmdobj = new SqlCommand(commandtext,conobj);
conobj.Open();
cmdobj.ExecuteNonQuery();
conobj.Close();

لطفا راهنمایی کنین
ممنون

mp2009
جمعه 03 دی 1389, 21:20 عصر
از لینک زیر کمک بگیر
http://www.connectionstrings.com/sql-server-2005