Ejemplo n.º 1
0
        /// <summary>
        /// 初始化分页存储过程
        /// </summary>
        private static void InitProc(DataBaseOperate oper)
        {
            if (isCheck)
            {
                return;
            }
            string      sql     = "select * from sysobjects where [xtype]='p' and [name]='" + ProcName + "'";
            bool        hasProc = false;
            IDataReader reader  = null;

            try
            {
                reader = oper.Query(sql, null, null);
                if (reader.Read())
                {
                    hasProc = true;
                }
                reader.Close();
                if (!hasProc)
                {
                    oper.Execute(GetProcCode(), null, null);
                }
            }
            finally
            {
                oper.AutoClose();
            }
            isCheck = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行Sql命令
        /// </summary>
        /// <param name="sql">sql语句</param>
        /// <param name="list">参数列表</param>
        /// <param name="commandType">命令类型</param>
        /// <param name="tables">缓存关联的表</param>
        public int ExecuteCommand(string sql, ParamList list, CommandType commandType,
                                  Dictionary <string, bool> cachetables)
        {
            int ret = -1;

            ret = _oper.Execute(sql, list, commandType, cachetables);
            return(ret);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 执行Sql命令
        /// </summary>
        /// <param name="BQL">sql语句</param>
        public int ExecuteCommand(BQLQuery BQL)
        {
            AbsCondition con = BQLKeyWordManager.ToCondition(BQL, _oper.DBInfo, null, true);
            Dictionary <string, bool> cacheTables = null;

            cacheTables = con.CacheTables;


            int ret = -1;

            con.Oper = _oper;
            ret      = _oper.Execute(con.GetSql(true), con.DbParamList, cacheTables);
            return(ret);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 执行SQL语句
        /// </summary>
        /// <param name="oper">数据库连接</param>
        /// <param name="lstSQL">SQL语句</param>
        /// <returns></returns>
        public static List <string> ExecuteSQL(DataBaseOperate oper, List <string> lstSQL)
        {
            List <string> resaults = new List <string>();

            using (BatchAction ba = oper.StarBatchAction())
            {
                foreach (string sql in lstSQL)
                {
                    try
                    {
                        int row = oper.Execute(sql, new Buffalo.DB.DbCommon.ParamList(), null);
                        resaults.Add("执行完毕;");
                    }
                    catch (Exception ex)
                    {
                        resaults.Add("执行错误:" + ex.Message);
                    }
                }
            }
            return(resaults);
        }