Ejemplo 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);
        }
Ejemplo n.º 2
0
        public static OracleCommand GetOraCommand(String tsConnectId)
        {
            OraDB loOraDB = new OraDB();

            loOraDB.Open();
            loOraDB.BeginTransaction();
            return(loOraDB.GetOraCommand());
        }
Ejemplo n.º 3
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;
        }