如题:winform如果捕获SQL数据库连接超时,是超时,不是断网连不上那种,好像用try...catch不行,有没有别的思路,大家帮帮忙,谢谢
try
{
if(conn.State == ConnectionState.Closed)
{
conn.Open();
conn.CommandTimeout =1;
conn.Close();();
}
}
catch (SqlException Sql)
{
MessageBox.Show(Sql.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}