public DataSet ExecuteDataSet(DbCommand cmd) { DbDataAdapter dbDataAdapter = dInterface.getDataAdapter(); dbDataAdapter.SelectCommand = cmd; DataSet ds = new DataSet(); dbDataAdapter.Fill(ds); return(ds); }
public DataTable GetAllTable() { string cmd = "SELECT * FROM " + TABLE_NAME; DataTable table = new DataTable(); using (DbConnection conn = di.getDbConnection(Config.Instance.ConnectString)) { try { DbCommand comm = di.getDbCommand(cmd); comm.Connection = conn; DbDataAdapter adapter = di.getDataAdapter(); adapter.SelectCommand = comm; conn.Open(); adapter.Fill(table); } finally { if (conn != null) { conn.Close(); } } } return(table); }