|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how to quickly check for database connectivity quicklyconnectivity 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(); } On Mon, 16 Oct 2006 08:38:02 -0700, Bluemel <Blue***@discussions.microsoft.com>
wrote: Show quote >I want to check for db connectivity from the onload event. If there is Why do you think you need to post the same question twice?>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(); >} Good luck with your project, Otis Mukinfus http://www.arltex.com http://www.tomchilders.com |
|||||||||||||||||||||||