public static DataSet ExecuteDataset(string connection, OracleCommand sqlcmd) { DataSet dataSet = new DataSet(); OracleConnection conn = OracleDataHelper.getConnectionByPool(connection); try { OracleDataAdapter myDbDA; myDbDA = new OracleDataAdapter(); myDbDA.SelectCommand = sqlcmd; sqlcmd.Connection = conn; myDbDA.Fill(dataSet); } catch (Exception e) { Console.WriteLine(e); } finally { try { OracleDataHelper.freeConnectionToPool(conn, connection); } catch (Exception e2) { Console.WriteLine(e2); } } return(dataSet); }
public static int ExecuteNonQuery(string connection, OracleCommand sqlcmd) { int resulState = -1; OracleConnection myConn = OracleDataHelper.getConnectionByPool(connection); OracleTransaction myTrans; myTrans = myConn.BeginTransaction(IsolationLevel.ReadCommitted); sqlcmd.Connection = myConn; sqlcmd.Transaction = myTrans; try { resulState = sqlcmd.ExecuteNonQuery(); myTrans.Commit(); } catch (Exception e) { myTrans.Rollback(); throw e; } finally { try { OracleDataHelper.freeConnectionToPool(myConn, connection); } catch (Exception err) { throw err; } } return(resulState); }