Example #1
0
 /// <summary>
 /// 执行SQL语句,返回受影响的行数
 /// </summary>
 /// <param name="sql">SQL语句</param>
 /// <param name="tableNames">受影响的表的表名</param>
 /// <returns></returns>
 public Object ExecuteScalar(String sql, String[] tableNames)
 {
     // 移除所有和受影响表有关的缓存
     if (EnableCache)
     {
         XCache.Remove(tableNames);
     }
     return(DB.ExecuteScalar(sql));
 }
Example #2
0
 /// <summary>
 /// 执行插入语句并返回新增行的自动编号
 /// </summary>
 /// <param name="sql"></param>
 /// <param name="tableNames">受影响的表的表名</param>
 /// <returns>新增行的自动编号</returns>
 public Int32 InsertAndGetIdentity(String sql, String[] tableNames)
 {
     // 移除所有和受影响表有关的缓存
     if (EnableCache)
     {
         XCache.Remove(tableNames);
     }
     return(DB.InsertAndGetIdentity(sql));
 }
Example #3
0
 /// <summary>
 /// 执行SQL语句,返回受影响的行数
 /// </summary>
 /// <param name="sql">SQL语句</param>
 /// <param name="tableNames">受影响的表的表名</param>
 /// <returns></returns>
 public Int32 Execute(String sql, String[] tableNames)
 {
     // 移除所有和受影响表有关的缓存
     if (EnableCache)
     {
         XCache.Remove(tableNames);
     }
     return(DB.Execute(sql));
 }
Example #4
0
        /// <summary>
        /// 执行CMD,返回受影响的行数
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="tableNames"></param>
        /// <returns></returns>
        public Int32 Execute(DbCommand cmd, String[] tableNames)
        {
            // 移除所有和受影响表有关的缓存
            if (EnableCache)
            {
                XCache.Remove(tableNames);
            }
            Int32 ret = DB.Execute(cmd);

            DB.AutoClose();
            return(ret);
        }