예제 #1
0
        public DataSet ExecuteDbDataSet(DbCommand scdCommand)
        {
            DbConnection Conn = ConexaoAntigo.abrirConexao();

            scdCommand.Connection = Conn;

            DbDataAdapter daAdapter = ConexaoAntigo.obterDataAdapter(scdCommand.Connection);

            try
            {
                DataSet dsDados = new DataSet();
                daAdapter.SelectCommand = scdCommand;
                daAdapter.Fill(dsDados);

                daAdapter = null;
                return(dsDados);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                daAdapter.Dispose();
                ConexaoAntigo.fecharConexao(scdCommand.Connection);
                scdCommand.Dispose();
            }
        }
예제 #2
0
        public DataTable ExecuteDbDataTable(DbCommand scdCommand, DbConnection Conn)
        {
            scdCommand.Connection = Conn;

            DbDataAdapter daAdapter = ConexaoAntigo.obterDataAdapter(scdCommand.Connection);

            try
            {
                DataTable dtTable = new DataTable();
                daAdapter.SelectCommand = scdCommand;
                daAdapter.Fill(dtTable);

                return(dtTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                daAdapter.Dispose();
                scdCommand.Dispose();
            }
        }