try
{
string strConnection = "-- connection string --- from web.config--";
SqlConnection objConnection = new SqlConnection(strConnection);
objConnection.Open();
btn.Enabled = true;
btn.Enabled = "Test Succeeded";
}
catch (Exception ex)
{
btn.Enabled = false;
btn.Enabled = "Test Failed!!";
}
|