Exemple #1
0
        public DataSet SP_OracleExecuteDataSet(string SPName, string[] Params1, string[] Params2)
        {
            GetTableData      myObjGetTableData = new GetTableData();
            ModifyDB          myObj             = new ModifyDB();
            OracleDataAdapter adapter           = new OracleDataAdapter();
            DataSet           dataSet           = null;

            try
            {
                if (!myObjGetTableData.checkUserSession())
                {
                    throw new cs.LMException("SessionDied");
                }
                cmd             = new OracleCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = SPName;
                cmd.Connection  = myObj.DBConnect();
                if ((Params1 != null || Params1.Length > 0) && (Params2 != null || Params2.Length > 0))
                {
                    for (int i = 0; i < Params1.Length; i++)
                    {
                        cmd.Parameters.AddWithValue(Params1[i], Params2[i]);
                    }
                }
                adapter.SelectCommand = cmd;
                dataSet = new DataSet();
                adapter.Fill(dataSet);
            }
            catch (cs.LMException ex)
            {
                throw ex;
            }
            catch (DbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { DBDisconnect(); }
            return(dataSet);
        }
Exemple #2
0
        public OracleDataReader SP_OracleExecuteReader(string SPName, string[] Params1, string[] Params2)
        {
            GetTableData  myObjGetTableData = new GetTableData();
            ModifyDB      myObj             = new ModifyDB();
            OracleCommand cmd;

            try
            {
                if (!myObjGetTableData.checkUserSession())
                {
                    throw new cs.LMException("SessionDied");
                }
                cmd             = new OracleCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = SPName;
                cmd.Connection  = myObj.DBConnect();
                if ((Params1 != null || Params1.Length > 0) && (Params2 != null || Params2.Length > 0))
                {
                    for (int i = 0; i < Params1.Length; i++)
                    {
                        cmd.Parameters.AddWithValue(Params1[i], Params2[i]);
                    }
                }
                return(cmd.ExecuteReader());
            }
            catch (cs.LMException ex)
            {
                throw ex;
            }
            catch (DbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { }
        }