Possible Duplicate:
How to check if connection string is valid?
Currently I'm doing it like this:
internal bool CheckConnection()
{
using (SqlConnection testConn = new SqlConnection(this.ConnectionString))
{
try
{
testConn.Open();
}
catch (SqlException)
{
return false;
}
}
return true;
}
Is there a better way to do this?