public void ProcessEachMultisetRow(OracleCommand command, out string errorMessage, DbRowMultisetProcessor readerData) { using (var conn = new OracleConnection()) { ProcessEachMultisetRow(conn, command, out errorMessage, readerData); } }
protected void ProcessEachMultisetRow(OracleConnection conn, OracleCommand command, out string errorMessage, DbRowMultisetProcessor readerData) { errorMessage = String.Empty; conn.ConnectionString = _connStr; command.Connection = conn; try { conn.Open(); } catch (Exception ex) { errorMessage = ex.Message; return; } OracleDataReader reader; try { reader = command.ExecuteReader(); } catch (Exception ex) { errorMessage = ex.Message; command.Dispose(); conn.Dispose(); return; } int nextResultSet = 0; do { while (reader.Read()) { try { readerData.Invoke(reader, nextResultSet); } catch (Exception ex) { errorMessage = ex.Message; break; } } nextResultSet++; } while (reader.NextResult()); try { reader.Dispose(); //Command.Dispose(); conn.Dispose(); } catch (Exception ex) { errorMessage = ex.Message; } }