sysadminClassadd.aspx.cs

(完整代码) 1KB

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;
using System.Data.SqlClient;

public partial class adminClass : System.Web.UI.Page
{
    SqlConnection conn;
    SqlCommand cmd;

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void enter_Click(object sender, EventArgs e)
    {
        conn = sqldata.createCon();
        conn.Open();
        string classID = this.classNo.Text;
        string className = this.className.Text;
        int deptID = Convert.ToInt32(this.DropDownList1.SelectedValue);
        string sql2 = "insert into class(classID,zhuanyeName,deptID)values(@classID,@className,@deptID)";
        cmd = new SqlCommand(sql2, conn);
        SqlParameter id1 = new SqlParameter("@classID", SqlDbType.VarChar,20);
        SqlParameter id2 = new SqlParameter("@className", SqlDbType.VarChar, 20);
        SqlParameter id3 = new SqlParameter("@deptID", SqlDbType.Int, 4);
        id1.Value = classID;
        id2.Value = className;
        id3.Value = deptID;
        cmd.Parameters.Add(id1);
        cmd.Parameters.Add(id2);
        cmd.Parameters.Add(id3);
        if (Convert.ToInt32(cmd.ExecuteNonQuery()) > 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "info", "alert('添加成功!');", true);
            this.className.Text = "";
            this.classNo.Text = "";
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "info", "alert('添加失败!');", true);
        }
    }
    protected void cancel_Click(object sender, EventArgs e)
    {
        this.className.Text = "";
        this.classNo.Text = "";
    }
}

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

AI 解读 AI

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

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