guestbook.aspx.cs

(完整代码) 1KB

using System;
using System.Data;
using System.Data.OleDb;
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 guestbook : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void submit_Click(object sender, EventArgs e)
    {
        if (name.Text == "")
            name.Text = "匿名";

        string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
        strConnection += Server.MapPath(@"App_Data\message.mdb");
        OleDbConnection objConnection = new OleDbConnection(strConnection);
        objConnection.Open();

        string subname, subject, subtime;
        subname = name.Text;
        subtime = System.DateTime.Now.ToString();
        subject = text.Text;

        string sql = "insert into message (subname,subtime,subject) values('"+subname+"','"+subtime+"','"+subject+"')";

        try
        {
            OleDbCommand thisCommand = new OleDbCommand(sql,objConnection);
            thisCommand.ExecuteNonQuery();
        }
        catch
        {
        }
        finally
        {
            objConnection.Close();
        }
        Response.Redirect("guestbook.aspx");
    }
    protected void noname_CheckedChanged(object sender, EventArgs e)
    {
        name.Text = "匿名";
    }
    protected void login_Click(object sender, ImageClickEventArgs e)
    {
        logindiv.Visible = true;
    }
}

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

AI 解读 AI

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

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