Beispiel #1
0
 public DataTable ExecuteQuery(string strQuery, SqlTransaction objTrans)
 {
     SqlCommand cmd = new SqlCommand();
     DataAccessLayer objDataAccess = new DataAccessLayer();
     try
     {
         cmd.CommandText = strQuery;
         cmd.Transaction = objTrans;
         cmd.Connection = objTrans.Connection;
         objDataAccess.Command = cmd;
         DataTable dt = new DataTable();
         dt = objDataAccess.GetTable();
         return dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         cmd.Dispose();
     }
 }
Beispiel #2
0
    public int getNoOfException(string strQuery, SqlTransaction objTrans)
    {
        SqlCommand cmd = new SqlCommand();
        DataAccessLayer objDataAccess = new DataAccessLayer();
        try
        {
            cmd.CommandText = strQuery;
            cmd.Transaction = objTrans;
            cmd.Connection = objTrans.Connection;
            objDataAccess.Command = cmd;
            DataTable dt = new DataTable();
            dt = objDataAccess.GetTable();

            return Convert.ToInt32(dt.Rows[0]["Rowcount"]);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            cmd.Dispose();
        }
    }