Admin/AddCourse.aspx.cs

(开头部分) 3KB

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

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 Admin_AddCourse : System.Web.UI.Page
{
    data mydata = new data();
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {

            DropDownList2.DataSource = mydata.GetDataReader("select * from  Xueyuan");
            DropDownList2.DataTextField = "Name";
            DropDownList2.DataValueField = "id";
            DropDownList2.DataBind();
            DropDownList1.DataSource = mydata.GetDataReader("select * from  zhuanye ");
            DropDownList1.DataTextField = "name";
            DropDownList1.DataValueField = "id";
            DropDownList1.DataBind();

            this.DropDownList3.DataSource = mydata.GetDv("select * from Teacher");
            this.DropDownList3.DataTextField = "UserName";
            this.DropDownList3.DataValueField = "xuehao";
            this.DropDownList3.DataBind();
        }
    }
    protected void btnadd_Click(object sender, EventArgs e)
    {
        data mydata = new data();
        Alert js = new Alert();
        mydata.RunSql("insert into Course(courseID,courseName,teacher,credithour,term,classname,Address,BeginTime,xueyuan,xueyuanid,zhuanye,zhuanyeid,TeacherId)values('" + txtNum.Text + "','" + txtName.Text + "','" + DropDownList3.SelectedItem.Text + "'," + txtCredit.Value + ",'" + txtTerm.Text + "','" + TextBox3.Text + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + DropDownList2.SelectedItem.Text + "','" + DropDownList2.SelectedValue + "','" + DropDownList1.SelectedItem.Text + "','" + DropDownList1.SelectedValue + "','" + DropDownList3.SelectedValue + "')");
        Alert.AlertAndRedirect("添加成功!", "AddCourse.aspx");
    }
    protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
    {

        Alert js = new Alert();
        string result = mydata.ReturnSql("select count(*) from Course where courseID='" + this.txtNum.Text + "'");//查询是否有指定的课程号
        if ("0".Equals(result))//没有指定的记录
        {
            args.IsValid = true;

        }
        else
        {
            args.IsValid = false;
        }
    }
    protected void CustomValidator2_ServerValidate(object source, ServerValidateEventArgs args)
    {

后面还有 19 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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