471,318 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

SQLConnection Timeout not working

Having issues iterating through passwords trying to find a few weak sa
connections. For some reason the timeout is not working on the servers I
cannot connect to. Any ideas?

foreach(XmlElement oPassword in oXml.DocumentElement.ChildNodes)
{

sConn = "uid=SA;database=MASTER;server=" + sServer + ";pwd=" +
oPassword.InnerText + ";Connect Timeout=5;Trusted_Connection=False";

try

{

SqlCon2.ConnectionString = sConn;

SqlCommand SqlCmd = new SqlCommand();

SqlCmd.CommandTimeout=5;

SqlCmd.Connection = SqlCon2;

SqlCon2.Open();
//CONNECTION MUST HAVE WORKED

//Do Other items

catch

{

SqlCon2.Close();

}
finally
{
SqlCon2.Close();
}
Jul 22 '05 #1
0 1018

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by huzz | last post: by
2 posts views Thread by Nils Magnus Englund | last post: by
reply views Thread by Matt M | last post: by
4 posts views Thread by =?Utf-8?B?VG9kZCBKYXNwZXJz?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.