MyLesson/ServiceUser/AddTopic.aspx.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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

using System.Text;
using System.Configuration;
using System.Collections;
using System.Data;


namespace MyLesson.ServiceUser
{
    public partial class AddTopic : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "";
            if (!IsPostBack)
            {
                if (Session["username"] == null)
                {
                  
                    AlertAndRedirect("对不起您还没有登录", "Default.aspx");
                }
            }
        }
        public static void AlertAndRedirect(string Message, string RedirectUrl)
        {
            string js = "";
            js = "<script language='javascript'>alert('{0}');window.location.replace('{1}')</script>";
            HttpContext.Current.Response.Write(string.Format(js, Message, RedirectUrl));


        } 
        protected void Button1_Click(object sender, EventArgs e)
        {

            SqlHelper data = new SqlHelper();
            data.RunSql("insert into Topic(Topic,AddUser,Content)values('" + tb_title.Text + "','" + Session["username"].ToString() + "','" + ArticleContent.Value + "')");
            Alert js = new Alert();
            js.Alertjs("发布成功");
            Response.Redirect("BBS.aspx");
        }
    }







    public class SqlHelper
    {
        public static readonly string connstring = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
        private static Hashtable parmCache = Hashtable.Synchronized(new Hashtable());
        private SqlConnection con;
后面还有 152 行代码,购买后查看完整代码

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

AI 解读 AI

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

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