예제 #1
0
파일: SqlDb.cs 프로젝트: hogberg43/App
 public DataSet ExecuteAndReturnDataSet(SqlCommand com, string exceptionMessage)
 {
     using (_conn)
     {
         var result = new DataSet();
         try
         {
             OpenConnection();
             com.Connection = _conn;
             new SqlDataAdapter(com).Fill(result);
         }
         catch (Exception ex)
         {
             var ae = new DBCommandException(exceptionMessage, ex);
             ae.AttachDbCommandMetaData(com);
             throw ae;
         }
         finally
         {
             com.Dispose();
             CloseConnection();
         }
         return result;
     }
 }
예제 #2
0
파일: SqlDb.cs 프로젝트: hogberg43/App
 public object ExecuteAndReturnScalar(SqlCommand com, string exceptionMessage)
 {
     using (_conn)
     {
         object result;
         try
         {
             OpenConnection();
             com.Connection = _conn;
             result         = com.ExecuteScalar();
         }
         catch (Exception ex)
         {
             var ae = new DBCommandException(exceptionMessage, ex);
             ae.AttachDbCommandMetaData(com);
             throw ae;
         }
         finally
         {
             com.Dispose();
             CloseConnection();
         }
         return(result);
     }
 }
예제 #3
0
파일: SqlDb.cs 프로젝트: hogberg43/App
 public TransactionStatus ExecuteTransaction(SqlCommand com, string exceptionMessage)
 {
     using (_conn)
     {
         var dt = new DataTable();
         try
         {
             OpenConnection();
             com.Connection = _conn;
             new SqlDataAdapter(com).Fill(dt);
         }
         catch (Exception ex)
         {
             var ae = new DBCommandException(exceptionMessage, ex);
             ae.AttachDbCommandMetaData(com);
             throw ae;
         }
         finally
         {
             com.Dispose();
             CloseConnection();
         }
         return(new TransactionStatus(dt));
     }
 }
예제 #4
0
파일: SqlDb.cs 프로젝트: hogberg43/App
 public DataSet ExecuteAndReturnDataSet(SqlCommand com, string exceptionMessage)
 {
     using (_conn)
     {
         var result = new DataSet();
         try
         {
             OpenConnection();
             com.Connection = _conn;
             new SqlDataAdapter(com).Fill(result);
         }
         catch (Exception ex)
         {
             var ae = new DBCommandException(exceptionMessage, ex);
             ae.AttachDbCommandMetaData(com);
             throw ae;
         }
         finally
         {
             com.Dispose();
             CloseConnection();
         }
         return(result);
     }
 }
예제 #5
0
파일: SqlDb.cs 프로젝트: hogberg43/App
 public void Execute(SqlCommand com, string exceptionMessage)
 {
     using (_conn)
     {
         try
         {
             OpenConnection();
             com.Connection = _conn;
             com.ExecuteNonQuery();
         }
         catch (Exception ex)
         {
             var ae = new DBCommandException(exceptionMessage, ex);
             ae.AttachDbCommandMetaData(com);
             throw ae;
         }
         finally
         {
             com.Dispose();
             CloseConnection();
         }
     }
 }
예제 #6
0
파일: SqlDb.cs 프로젝트: hogberg43/App
 public void Execute(SqlCommand com, string exceptionMessage)
 {
     using (_conn)
     {
         try
         {
             OpenConnection();
             com.Connection = _conn;
             com.ExecuteNonQuery();
         }
         catch (Exception ex)
         {
             var ae = new DBCommandException(exceptionMessage, ex);
             ae.AttachDbCommandMetaData(com);
             throw ae;
         }
         finally
         {
             com.Dispose();
             CloseConnection();
         }
     }
 }
예제 #7
0
파일: SqlDb.cs 프로젝트: hogberg43/App
        public TransactionStatus ExecuteTransaction(SqlCommand com, string exceptionMessage)
        {
            using (_conn)
            {
                var dt = new DataTable();
                try
                {
                    OpenConnection();
                    com.Connection = _conn;
                    new SqlDataAdapter(com).Fill(dt);

                }
                catch (Exception ex)
                {
                    var ae = new DBCommandException(exceptionMessage, ex);
                    ae.AttachDbCommandMetaData(com);
                    throw ae;
                }
                finally
                {
                    com.Dispose();
                    CloseConnection();
                }
                return new TransactionStatus(dt);
            }
        }
예제 #8
0
파일: SqlDb.cs 프로젝트: hogberg43/App
 public object ExecuteAndReturnScalar(SqlCommand com, string exceptionMessage)
 {
     using (_conn)
     {
         object result;
         try
         {
             OpenConnection();
             com.Connection = _conn;
             result = com.ExecuteScalar();
         }
         catch (Exception ex)
         {
             var ae = new DBCommandException(exceptionMessage, ex);
             ae.AttachDbCommandMetaData(com);
             throw ae;
         }
         finally
         {
             com.Dispose();
             CloseConnection();
         }
         return result;
     }
 }