예제 #1
0
 public static DataSet ExecuteDataSet(string commandTextOrSpName, CommandType commandType, IDictionary <string, object> dictionary)
 {
     using (SqlConnection_RW conn = new SqlConnection_RW(DbType, ConnString_R, ConnString_RW))
     {
         using (DbCommandCommon cmd = new DbCommandCommon(DbType))
         {
             PreparCommand(conn.DbConnection, cmd.DbCommand, commandTextOrSpName, commandType, dictionary);
             using (DbDataAdapterCommon da = new DbDataAdapterCommon(DbType, cmd.DbCommand))
             {
                 DataSet ds = new DataSet();
                 da.Fill(ds);
                 return(ds);
             }
         }
     }
 }
예제 #2
0
 /**
  * Update At 2017-3-2 14:58:45
  * Add the ExecuteDataTable Method into Sql_Helper_DG
  **/
 public static DataTable ExecuteDataTable(string commandTextOrSpName, CommandType commandType = CommandType.Text)
 {
     using (SqlConnection_RW conn = new SqlConnection_RW(DbType, ConnString_R, ConnString_RW))
     {
         using (DbCommandCommon cmd = new DbCommandCommon(DbType))
         {
             PreparCommand(conn.DbConnection, cmd.DbCommand, commandTextOrSpName, commandType);
             using (DbDataAdapterCommon da = new DbDataAdapterCommon(DbType, cmd.DbCommand))
             {
                 DataSet ds = new DataSet();
                 da.Fill(ds);
                 if (ds.Tables.Count > 0)
                 {
                     return(ds.Tables[0]);
                 }
                 return(default(DataTable));
             }
         }
     }
 }