📄 addcourse.aspx.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 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -