Check if connection state is closed before opening

This commit is contained in:
2026-09-15 08:21:18 -04:00
parent 5d4e5d9a1f
commit 7c95b115e4
84 changed files with 291 additions and 291 deletions
@@ -290,7 +290,7 @@ namespace VEPROMS.CSLA.Library
string tmp = constr.Replace("{MENU}", "master");
using (SqlConnection cn = new SqlConnection(tmp))
{
cn.Open();
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
using (SqlDataAdapter da = new SqlDataAdapter("select name, 'Approval' functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn))
{
da.SelectCommand.CommandTimeout = 300; // 300 sec timeout
@@ -340,7 +340,7 @@ namespace VEPROMS.CSLA.Library
SqlConnection cn = new SqlConnection(strConn);
try
{
cn.Open();
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
return cn;
}
catch (SqlException exsql)