G
Guest
I want to check for db connectivity from the onload event. If there is
connectivity I will update and xml file. I am trying to use the connection
string Connection Timeout setting, however the Conneciton Timeout setting
will not go below the default of 15 seconds. I can set it to 20 or over and
it changes it, but if I set it to 5 as shown in my code below it defaults to
15.
I am up for other suggestions on how to check for connectivity, my code is
below.
try
{
m_Connection = new SqlConnection("workstation id=\"BLUEMELJ-A\";packet
size=4096;integrated security=SSPI;data source" +"=\"(local)\";persist
security info=False;Connection Timeout=5;initial catalog=master");
MessageBox.Show(m_Connection.ConnectionTimeout.ToString());
m_Connection.Open();
}
catch (System.Exception ex)
{
MessageBox.Show("Catch");
m_Connection.Close();
}
connectivity I will update and xml file. I am trying to use the connection
string Connection Timeout setting, however the Conneciton Timeout setting
will not go below the default of 15 seconds. I can set it to 20 or over and
it changes it, but if I set it to 5 as shown in my code below it defaults to
15.
I am up for other suggestions on how to check for connectivity, my code is
below.
try
{
m_Connection = new SqlConnection("workstation id=\"BLUEMELJ-A\";packet
size=4096;integrated security=SSPI;data source" +"=\"(local)\";persist
security info=False;Connection Timeout=5;initial catalog=master");
MessageBox.Show(m_Connection.ConnectionTimeout.ToString());
m_Connection.Open();
}
catch (System.Exception ex)
{
MessageBox.Show("Catch");
m_Connection.Close();
}