⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default1.aspx.cs

📁 在线小说阅读
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
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;

namespace novel
{
    public partial class default1 : System.Web.UI.Page
    {
        DB_Class pdb = new DB_Class();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int topicid = Convert.ToInt32(Request.QueryString["topicid"]);
                string sqlstr = "update novel_topic set hits=hits+1 where topicid=" + topicid + " ";
                pdb.ExecSql(sqlstr);
                GetList_topic(topicid);
            }
        }

        public void GetList_topic(int topicid)
        {

            List_topic.DataSource = pdb.dst("select ImageUrl,title,author,chapter,left(intro,15) as intro,hits from novel_topic where topicid=" + topicid + " ").Tables[0].DefaultView;
            List_topic.DataBind();

            List_novel.DataSource = pdb.dst("select chapterid,chapter from novel_chapter9 where topicid=" + topicid + " and type='免费' ").Tables[0].DefaultView;
            List_novel.DataBind();

            List_novel2.DataSource = pdb.dst("select chapterid,chapter from novel_chapter9 where topicid=" + topicid + " and type='收费' ").Tables[0].DefaultView;
            List_novel2.DataBind();

            List_Comment.DataSource = pdb.dst("select sender,content,times from novel_comment where topicid=" + topicid + " ").Tables[0].DefaultView;
            List_Comment.DataBind();
        }

        protected void Button_comment_Click(object sender, EventArgs e)
        {
            int topicid1 = Convert.ToInt32(Request.QueryString["topicid"]);
            String insert = "insert into novel_comment(topicid,content) values(" + topicid1 + ",'" + TextBox_comment.Text + "') ";
            if (pdb.ExecSql(insert))
            {
                GetList_topic(topicid1);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MessageBox", "alert('保存成功')", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MessageBox", "alert('保存失败,请检查!')", true);
            }
        }
        /*  protected void Button1_Click1(object sender, EventArgs e)
          {
              int topicid = Convert.ToInt32(Request.QueryString["topicid"]);
              String insert = "insert into novel_comment(topicid,content) values(" + topicid + ",'" + TextBox_comment.Text + "') ";
              if (pdb.ExecSql(insert))
              {
                  Page.ClientScript.RegisterStartupScript(this.GetType(), "MessageBox", "alert('保存成功')", true);
              }
              else
              {
                  Page.ClientScript.RegisterStartupScript(this.GetType(), "MessageBox", "alert('保存失败,请检查!')", true);
              }
          }*/

    }
}

⌨️ 快捷键说明

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