When i click button an I always get an Error thatAn 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)
This is My connection string
string conn =@"Data Source = .;Initial Catalog= Product;Integrated Security = True"; DataTable objDT = new DataTable();
SqlConnection objCon = new SqlConnection(conn);
objCon.Open();SqlDataAdapter objDA = new SqlDataAdapter("Select* from product", objCon);
objDA.Fill(objDT);
objCon.Close();
this.dataGridView1.DataSource = objDT;
}
catch (Exception ex)
{
MessageBox.Show("The Systems generated following error: " + ex.Message);
}
Please Help me . I Have a Big Trouble