addcourse.aspx.cs

来自「成绩管理系统」· CS 代码 · 共 52 行

CS
52
字号
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 AddCourse : System.Web.UI.Page
{
    DataBase Dboper = new DataBase();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserType"]==null || Session["UserType"].ToString() != "0")
            Response.Redirect("UserLogin.aspx");
        if (!IsPostBack)
        {
            BindDrop();
        }
    }

    protected void BindDrop()
    {
        this.DropDownList1.DataTextField = "UserName";
        this.DropDownList1.DataValueField = "UserPass";
        this.DropDownList1.DataSource = Dboper.BindGrid("User_info", "*", " where UserType='1'", "");
        this.DropDownList1.DataBind();

    }
    protected void Button_Confirm_Click(object sender, EventArgs e)
    {
        if (this.DropDownList1.SelectedIndex < 0)
        {
            this.Label_Msg.Text = "请先选择任务说明教师!";
            return;
        }
        string InsertStr="(courseid,coursename,teacher)";
        InsertStr += "values('"+this.TextBox_CourseId.Text+"','"+this.TextBox_CourSeName.Text+"','"+this.DropDownList1.SelectedItem.Text+"')";
        this.Label_Msg.Text = Dboper.InsertData("CourseInfo", InsertStr);


    }

    protected void Top1_Load(object sender, EventArgs e)
    {

    }
}

⌨️ 快捷键说明

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