public void ExecuteNonQuery(OracleCommand command, out string errorMessage, DbRowParameterProcessor reader = null, List <Thread> threads = null) { string _errorMessage = string.Empty; if (threads != null) { var thread = new Thread(() => { using (var conn = new OracleConnection()) { ExecuteNonQuery(conn, command, out _errorMessage, reader); } }); thread.CurrentCulture = Thread.CurrentThread.CurrentCulture; thread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture; threads.Add(thread); thread.Start(); } else { using (var conn = new OracleConnection()) { ExecuteNonQuery(conn, command, out _errorMessage, reader); } } errorMessage = _errorMessage; }
protected void ExecuteNonQuery(OracleConnection conn, OracleCommand command, out string errorMessage, DbRowParameterProcessor readerData = null) { conn.ConnectionString = _connStr; try { command.Connection = conn; conn.Open(); command.ExecuteNonQuery(); errorMessage = String.Empty; try { if (readerData != null) { readerData.Invoke(command.Parameters); } } catch (Exception ex) { errorMessage = ex.Message; } } catch (Exception ex) { errorMessage = ex.Message; } finally { command.Dispose(); conn.Dispose(); } }