SqlScripter.Core/src/Data/SqlCommon.cs
/// <summary>
/// Creates a new <see cref="DataSet"/> and uses given <see cref="SqlDataAdapter"/> to fill it.
/// </summary>
/// <param name="sqlDataAdapter"></param>
/// <param name="flag"></param>
/// <returns></returns>
Creates a new  and uses given  to fill it.
Creates a new and uses given to fill it .
public DataSet Fill(SqlDataAdapter sqlDataAdapter, SqlFlag flag, IsolationLevel isolationLevel) {
            if (sqlDataAdapter == null) {
                throw new ArgumentNullException("sqlDataAdapter");
            }
            SqlCommand selectCommand = sqlDataAdapter.SelectCommand;
            if (selectCommand == null) {
                throw new ArgumentException("Given sqlDataAdapter must have SelectCommand set", "sqlDataAdapter");
            }
            EnsureOpenConnection(selectCommand);
            EnsureOpenTransaction(selectCommand, isolationLevel);
            if (selectCommand.CommandType == CommandType.StoredProcedure) {
                EnsureReturnValueParameter(selectCommand);
            }
            try {
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder();
                commandBuilder.DataAdapter = sqlDataAdapter;
                DataSet ds = new DataSet();
                sqlDataAdapter.Fill(ds);
                CleanUp(selectCommand, flag);
                return ds;
            } catch (Exception e) {
                if ((flag & SqlFlag.RollbackTxOnError) == SqlFlag.RollbackTxOnError) {
                    RollbackTx(selectCommand.Transaction);
                }
                if ((flag & SqlFlag.CloseConnectionOnError) == SqlFlag.CloseConnectionOnError) {
                    CloseConnection(selectCommand.Connection);
                }
                throw new SqlCommonException(selectCommand, e); 
            }
        }
public DataSet Fill ( SqlDataAdapter sqlDataAdapter , SqlFlag flag , IsolationLevel isolationLevel ) { if ( sqlDataAdapter == null ) { throw new ArgumentNullException ( " " ) ; } SqlCommand selectCommand = sqlDataAdapter . SelectCommand ; if ( selectCommand == null ) { throw new ArgumentException ( " " , " " ) ; } EnsureOpenConnection ( selectCommand ) ; EnsureOpenTransaction ( selectCommand , isolationLevel ) ; if ( selectCommand . CommandType == CommandType . StoredProcedure ) { EnsureReturnValueParameter ( selectCommand ) ; } try { SqlCommandBuilder commandBuilder = new SqlCommandBuilder ( ) ; commandBuilder . DataAdapter = sqlDataAdapter ; DataSet ds = new DataSet ( ) ; sqlDataAdapter . Fill ( ds ) ; CleanUp ( selectCommand , flag ) ; return ds ; } catch ( Exception e ) { if ( ( flag & SqlFlag . RollbackTxOnError ) == SqlFlag . RollbackTxOnError ) { RollbackTx ( selectCommand . Transaction ) ; } if ( ( flag & SqlFlag . CloseConnectionOnError ) == SqlFlag . CloseConnectionOnError ) { CloseConnection ( selectCommand . Connection ) ; } throw new SqlCommonException ( selectCommand , e ) ; } }
Creates a new  and uses given  to fill it.
Creates a new and uses given to fill it .
//if (log.IsWarnEnabled) log.Warn("Exception caugth: "+e.Message,e); // always throwing exception
None
sqlDataAdapter
SqlDataAdapter
None
flag
SqlFlag
None
isolationLevel
IsolationLevel