예제 #1
0
        public static bool IsExist(long attrValueID)
        {
            SqlParameter[] pramsWhere =
            {
                DAL.DALUtil.MakeInParam("@attrValueID", System.Data.SqlDbType.Int, 4, attrValueID),
            };
            int count = DALUtil.ConvertToInt32(DBCommon.DBHelper.GetSingle(ConnString, TableName, "Count(0)", pramsWhere));

            return(count > 0);
        }
예제 #2
0
        /// <summary>
        /// 获取数据总数量
        /// 条件:a=1 and b=2
        /// </summary>
        /// <param name="strWhere">条件(a=1 and b=2)</param>
        /// <param name="valuesList">条件集合值</param>
        public static int GetRecordCount(string strWhere, List <object> valuesList)
        {
            string SelectIF = " count(1) ";
            object obj      = DBCommon.DBHelper.GetSingle(ConnString, TableName, SelectIF, strWhere, valuesList.ToArray());

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(DALUtil.ConvertToInt32(obj));
            }
        }
예제 #3
0
        //#region 修改
        ///// <summary>
        ///// 修改
        ///// </summary>
        ///// <param name="pramsModify">修改参数集合</param>
        ///// <param name="pramsWhere">条件集合</param>
        ///// <returns>成功返回影响行数,失败返回0</returns>
        //public static int Modify(long categoryID, string name, long parentID, int level, bool isLeaf)
        //{
        //    SqlParameter[] pramsModify =
        //    {
        //        DALUtil.MakeInParam("@categoryID",SqlDbType.Int,4,categoryID),
        //        DALUtil.MakeInParam("@name",SqlDbType.NVarChar,100,name),
        //        DALUtil.MakeInParam("@parentID",SqlDbType.Int,4,parentID),
        //        DALUtil.MakeInParam("@level",SqlDbType.Int,4,level),
        //        DALUtil.MakeInParam("@isLeaf",SqlDbType.Int,4,(isLeaf==true?1:0)),

        //    };
        //    SqlParameter[] pramsWhere =
        //                    {
        //                        DALUtil.MakeInParam("@categoryID",SqlDbType.BigInt,4,categoryID)
        //                     };
        //    return DBCommon.DBHelper.Modify(ConnString, TableName, pramsModify, pramsWhere);
        //}

        ///// <summary>
        ///// 修改
        ///// </summary>
        ///// <param name="pramsModify">修改参数集合</param>
        ///// <param name="id">ID</param>
        ///// <returns>成功返回影响行数,失败返回0</returns>
        //public static int Modify(SqlParameter[] pramsModify, int id)
        //{
        //    SqlParameter[] pramsWhere =
        //    {
        //        DALUtil.MakeInParam("@ID",SqlDbType.Int,4,id)
        //    };
        //    return DBCommon.DBHelper.Modify(ConnString, TableName, pramsModify, pramsWhere);
        //}

        //#endregion

        #region 获取一个数据
        /// <summary>
        /// 获取一个数据[判断是否存在,获取最大值]
        /// 条件 :a=1
        /// </summary>
        /// <param name="SelectIF">查询数据</param>
        /// <param name="sqlWhere">条件 a=1</param>
        /// <param name="values">值</param>
        /// <returns>返回数据</returns>
        public static int GetSingle(string SelectIF, string sqlWhere, params object[] values)
        {
            object obj = DBCommon.DBHelper.GetSingle(ConnString, TableName, SelectIF, sqlWhere, values);

            return(DALUtil.ConvertToInt32(obj));
        }