Check if connection state is closed before opening
This commit is contained in:
@@ -394,7 +394,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!IsDirty) return;
|
||||
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
|
||||
{
|
||||
cn.Open();
|
||||
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
|
||||
_LastChanged = Annotation.Add(cn, ref _AnnotationID, myItem, _MyAnnotationType, _RtfText, _SearchText, _Config, _DTS, _UserID);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!IsDirty) return;
|
||||
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
|
||||
{
|
||||
cn.Open();
|
||||
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
|
||||
_LastChanged = Annotation.Update(cn, ref _AnnotationID, myItem.ItemID, _TypeID, _RtfText, _SearchText, _Config, _DTS, _UserID, ref _LastChanged);
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (IsNew) return;
|
||||
using (SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"])
|
||||
{
|
||||
cn.Open();
|
||||
if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
|
||||
Annotation.Remove(cn, _AnnotationID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user