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
@@ -614,7 +614,7 @@ namespace VEPROMS.CSLA.Library
_MyContent?.Update();
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
cn.Open();
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
@@ -732,7 +732,7 @@ namespace VEPROMS.CSLA.Library
_MyContent?.Update();
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
cn.Open();
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
if (base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
@@ -780,7 +780,7 @@ namespace VEPROMS.CSLA.Library
{
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
{
cn.Open();
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
if (IsNew)
_LastChanged = Detail.Add(cn, ref _DetailID, _MyContent, _ItemType, _Text, _Config, _DTS, _UserID);
else
@@ -910,7 +910,7 @@ namespace VEPROMS.CSLA.Library
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;