Пример #1
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from " + PubConstant.date_prefix + "Role ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            DbHelpers.NonQuery(strSql.ToString(), parameters);
        }
Пример #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ROYcms.Sys.Model.ROYcms_Role model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + PubConstant.date_prefix + "Role set ");
            strSql.Append("name=@name,");
            strSql.Append("zhaiyao=@zhaiyao,");
            strSql.Append("Time=@Time");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",      SqlDbType.Int,       4),
                new SqlParameter("@name",    SqlDbType.VarChar,  50),
                new SqlParameter("@zhaiyao", SqlDbType.VarChar, 100),
                new SqlParameter("@Time",    SqlDbType.DateTime)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.name;
            parameters[2].Value = model.zhaiyao;
            parameters[3].Value = model.Time;

            DbHelpers.NonQuery(strSql.ToString(), parameters);
        }