AddNews.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AddNews : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            if (Session["studentid"] == null) 
            {
                Response.Write("<script>parent.sayhello();</script>");
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Intro.Value != "" && Session["studentid"] != null) 
        {
            int result = DBUtility.DbHelperSQL.ExecuteSql("insert into question(yhid,question,flag) values(" + Session["studentid"].ToString() + ",'" + Intro.Value + "','待回复')");
            if (result == 1)//代表成功
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), System.DateTime.Now.Ticks.ToString(), "alert('提问成功!');parent.layer.closeAll();", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), System.DateTime.Now.Ticks.ToString(), "alert('系统错误,请检查数据库设置问题!');", true);
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。