Checking for db connectivity

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to check for db connectivity during the onload event. To do this
I use the connection time setting from the connection string. It allows me
to set it higher than the default of 15, however if I set it to 5 for example
it defaults back to 15.

I am up for other ways to accomplish this task. Basically I am trying to
check for db connectivity and then update an xml file.

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();
}
 
I am trying to check for db connectivity during the onload event. To do this
I use the connection time setting from the connection string. It allows me
to set it higher than the default of 15, however if I set it to 5 for example
it defaults back to 15.

I am up for other ways to accomplish this task. Basically I am trying to
check for db connectivity and then update an xml file.

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();
}
Why do you think you need to post the same question twice?
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Probably because the timeout isn't set until you actually open it.

Put the messagebox AFTER open to verify

Jeff
 
Back
Top