Check if connection state is closed before opening
This commit is contained in:
@@ -326,7 +326,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 = Part.Add(cn, myContent, _FromType, _MyItem, _DTS, _UserID);
|
||||
}
|
||||
|
||||
@@ -338,7 +338,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 = Part.Update(cn, myContent.ContentID, _FromType, _ItemID, _DTS, _UserID, ref _LastChanged);
|
||||
}
|
||||
|
||||
@@ -352,7 +352,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();
|
||||
Part.Remove(cn, myContent.ContentID, _FromType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user