public static DataSet Run(IDBHelper db, string sql) { using(DbConnection conn = db.CreateConnection()) { conn.Open(); DbCommand cmd = conn.CreateCommand(); cmd.CommandText = sql; using (DbDataAdapter adapter = db.CreateDataAdapter()) { DataSet ds = new DataSet(); adapter.SelectCommand = cmd; adapter.Fill(ds); return ds; } } }
public DbConnection CreateConnection() { return(_IDBHelper.CreateConnection(Config.GetInstance().DB)); }