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

📄 details.aspx.cs

📁 一个简单的聊天代码
💻 CS
字号:
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 clear : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        { Add_nod();
        if (Request.QueryString["id"] != null)
        { bind(); }
       } 
    }
    void bind()
    {
        string iidd,userfrom;
        iidd = spstr.tosql(Request.QueryString["id"]);
        DataTable dt = Spbase.GreatDs("Select * from info where id=" + iidd).Tables[0];
        Repeater1.DataSource =dt; 
        Repeater1.DataBind();
        userfrom =dt.Rows[0]["userfrom"].ToString();  
        Repeater3.DataSource = Spbase.GreatDs("Select*from usercenter where usertext='"+userfrom+"'");
        Repeater3.DataBind();
        Repeater2.DataSource = Spbase.GreatDs("Select*from book where idd=" + iidd);
        Repeater2.DataBind();
    }
    void Add_nod()
    {
        string qpm;
        qpm = spstr.tosql(Request.QueryString["id"]);

        string sql;
        sql = "update info set nod=nod+1 where id=" + qpm;
        Spbase.DoSql(sql);
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        {
            if (TextBox1.Text == "" || TextBox2.Text == "")
            {
                Sp.MessageBox.Show(this.Page, "帐号或密码为空,必须是会员才能回复!");
            }
            else
            {
                string pu, pw;
                pu = spstr.tosql(TextBox1.Text);
                pw = spstr.tosql(TextBox2.Text);
                string sql = "select * from usercenter where usertext='" + pu + "' and userpass='" + pw + "'";
                DataTable dt = new DataTable();
                dt = Spbase.GreatDs(sql).Tables[0];

                if (dt.Rows.Count < 1)
                { Sp.MessageBox.Show(this.Page, "用户名或帐号错误,必须是会员才能回复!"); }
                else
                {

                    if (TextBox3.Text == "")
                    { Sp.MessageBox.Show(this.Page, "留言内容不能为空!"); }
                    else
                    {
                        string hhu, iidd;
                        iidd = spstr.tosql(Request.QueryString["id"]);
                        hhu = spstr.tosql(TextBox3.Text);
                        sql = "insert into book (ib,idd,lz) values ('" + hhu + "'," + iidd + ",'" + pu + "')";
                        Spbase.DoSql(sql);
                        Sp.MessageBox.Show(this.Page, "回复成功!");
                        bind();
                    }
                }
            }
        }
    }
}

⌨️ 快捷键说明

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