Esempio n. 1
0
        /// <summary>
        /// 带事务执行SQL文:例子DataSet loginDS=sysConfig.exeusesql("Login.aspx.cs123",strsql,"DefaultSQL","dt");
        /// </summary>
        /// <param name="sql">SQL文</param>
        /// <param name="connectID">连接取"DefaultSQL","Oracle","Sybase"等值</param>
        /// <returns></returns>
        public static bool ExeuseSQL(string[] sql)
        {
            bool result = true;

            try
            {
                OraDB conspy = new OraDB();
                conspy.Open();
                conspy.BeginTransaction();
                try
                {
                    for (int i = 0; i < sql.Length; i++)
                    {
                        conspy.ExecSqlTrans(sql[i]);
                    }
                    conspy.Commit();
                }
                catch (Exception e)
                {
                    String lsError = e.Message;
                    conspy.Rollback();
                    result = false;
                }
                finally
                {
                    conspy.Close();
                }
            }
            catch (Exception e)
            {
                String lsError = e.Message;
                result = false;
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 返回Command 自己执行带参数的sql
        /// </summary>
        /// <param name="tsConnectId"></param>
        /// <returns></returns>
        public static OracleCommand GetOraCommand(String dbStr)
        {
            OraDB loOraDB = new OraDB();

            loOraDB.Open(dbStr);
            return(loOraDB.GetOraCommand());
        }
Esempio n. 3
0
        public static int ExecSP(String SPName)
        {
            OraDB oledb = new OraDB();

            oledb.Open();
            int i = oledb.ExecSP(SPName);

            oledb.Close();
            return(i);
        }
Esempio n. 4
0
        /// <summary>
        /// 执行SQL文

        /// </summary>
        /// <param name="sql">SQL文</param>
        /// <param name="connectID">连接取"DefaultSQL","Oracle","Sybase"等值</param>
        /// <returns>返回结果,错误返回-1</returns>
        public static int ExecSQL(string strFileName, string sql, ref string ErrorInfo)
        {
            OraDB myol = new OraDB();

            myol.Open();
            int i = myol.ExecSQL(sql, ref ErrorInfo);

            myol.Close();
            return(i);
        }
Esempio n. 5
0
        /// <summary>
        /// 执行SQL文到DataSet:例子DataSet loginDS=sysConfig.exeusesql("Login.aspx.cs123",strsql,"DefaultSQL","dt");
        /// </summary>
        /// <param name="strFileName"></param>
        /// <param name="sql"></param>
        /// <param name="ds"></param>
        /// <param name="ErrorInfo"></param>
        /// <returns></returns>
        public static int SelectSQL(string strFileName, string sql, ref DataSet ds, ref string ErrorInfo)
        {
            int     iResult    = -1;
            string  strMyError = "";
            DataSet tempds     = new DataSet();
            OraDB   conspy     = new OraDB();

            conspy.Open();
            try
            {
                iResult = conspy.SelectDataToDataSet(tempds, sql, ref strMyError);
                ds      = tempds.Copy();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                conspy.Close();
            }
            return(iResult);
        }