示例#1
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="dtomodList">数据对象</param>
        /// <returns></returns>
        public static int Updatemod(NoticeMOD mod)
        {
            string sqlCommandString = "Update Notice Set Title=@Title, contents=@contents";
            SqlParameter[] arParams = new SqlParameter[2];
            arParams[0] = new SqlParameter("@Title", mod.Title);
            arParams[1] = new SqlParameter("@contents", mod.Contents);

            return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlCommandString, arParams);
        }
示例#2
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="dtomodList">对象</param>
        /// <returns></returns>
        public static int Insertmod(NoticeMOD mod)
        {
            string sqlCommandString = "Insert Into Notice(title,contents)Values(@title,@contents)";
            SqlParameter[] arParams = new SqlParameter[2];
            arParams[0] = new SqlParameter("@title", mod.Title);
            arParams[1] = new SqlParameter("@contents", mod.Contents);

            return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlCommandString, arParams);
        }
示例#3
0
        /// <summary>
        /// 根据主键id查询信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static NoticeMOD GetmodByid(int id)
        {
            NoticeMOD mod = new NoticeMOD();
            string sqlcommandString = "select * from Notice where imgId=" + id;

            try
            {
                SqlDataReader reader = SqlHelper.ExecuteReader(sqlcommandString);
                if (reader.Read())
                {
                    mod.Contents = reader["Contents"].ToString();
                    mod.Title = reader["Title"].ToString();
                    mod.NoticeId = Convert.ToInt32(reader["NoticeId"].ToString());

                }
                reader.Close();
                return mod;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#4
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="dtomodList">数据对象</param>
 /// <returns></returns>
 public static int Updatemod(NoticeMOD mod)
 {
     return NoticeDAO.Updatemod(mod);
 }
示例#5
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="dtomodList">对象</param>
 /// <returns></returns>
 public static int Insertmod(NoticeMOD mod)
 {
     return NoticeDAO.Insertmod(mod);
 }