bbs_add.aspx.cs

来自「网络企业信息管理系统」· CS 代码 · 共 42 行

CS
42
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class BBS_BBS_Add : System.Web.UI.Page
{
    WebService webService = new WebService();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserID"] == null || Session["UserLevel"] == null)
        {
            Response.Redirect("~/Error.aspx");
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.tbContent.Text == "" || this.tbTitle.Text == "")
        {
            this.lblMsg.Text = "请输入完整信息";
        }
        else
        {
            string strTitle = this.tbTitle.Text;
            string strContent = this.tbContent.Text;
            string strSql = "Insert into z_BbsMessage(BM_Title,BM_Content,BM_AddDate,BM_AddPersonID,BM_Replies) values ('" + strTitle + "','" + strContent + "','" + DateTime.Now + "','" + Session["UserID"] + "','0');";
            webService.ExcuteSql(strSql);
            Response.Redirect("BBS_List.aspx");
        }
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("BBS_List.aspx");
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?