Exemple #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);
        }
Exemple #2
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;
        }