protected void Button1_Click(object sender, EventArgs e) { Model.Newscate mn = new Model.Newscate(); BLL.Newscate bn = new BLL.Newscate(); mn.Catename = name.Text; int result = bn.insert(mn); if (result > 0) { Response.Write("<script>alert('添加成功'),location.href='newscate.aspx'</script>"); } else { Response.Write("<script>alert('添加失败'),location.href='newscate.aspx'</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Model.Newscate mn = new Model.Newscate(); mn.ID = Convert.ToInt32(Request.QueryString["uid"]); BLL.Newscate bn = new BLL.Newscate(); SqlDataReader sdr = bn.sqldatareader(mn); if (sdr.Read()) { Label1.Text = sdr["_cateid"].ToString(); name.Text = sdr["_catename"].ToString(); } sdr.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Model.Newscate mn = new Model.Newscate(); mn.ID = Convert.ToInt32(Request.QueryString["uid"]); BLL.Newscate bn = new BLL.Newscate(); MySqlDataReader sdr = bn.sqldatareader(mn); if (sdr.Read()) { Label1.Text = sdr["_cateid"].ToString(); name.Text = sdr["_catename"].ToString(); } sdr.Close(); } }
protected void Button1_Click(object sender, EventArgs e) { Model.Newscate mn = new Model.Newscate(); mn.Catename = name.Text; mn.ID = Convert.ToInt32(Label1.Text); BLL.Newscate bn = new BLL.Newscate(); int result = bn.update(mn); if (result > 0) { Response.Write("<script>alert('更新成功'),location.href='newscate.aspx'</script>"); } else { Response.Write("<script>alert('更新失败'),location.href='newscate.aspx'</script>"); } }