Added Using statements

This commit is contained in:
John Jenko 2012-02-14 15:49:14 +00:00
parent 7d6d6952df
commit c2d645ab91

View File

@ -189,12 +189,18 @@ namespace VEPROMS.CSLA.Library
{ {
try try
{ {
SqlConnection cn = VEPROMS_SqlConnection; //SqlConnection cn = VEPROMS_SqlConnection;
SqlCommand cmd = new SqlCommand("purgedata", cn); //SqlCommand cmd = new SqlCommand("purgedata", cn);
using (SqlConnection cn = VEPROMS_SqlConnection)
{
using (SqlCommand cmd = new SqlCommand("purgedata", cn))
{
cmd.CommandType = CommandType.StoredProcedure; cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 0; cmd.CommandTimeout = 0;
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
}
}
catch (Exception ex) catch (Exception ex)
{ {
if (_MyLog.IsErrorEnabled) _MyLog.Error("Purge Error", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("Purge Error", ex);