System/Sys_Lesson_Add.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.OleDb;

public partial class System_Sys_Course_Add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DB.Bind_Dropdownlist("select * from X_Manager where X_Manager_Idfy='教师' order by X_Manager_ID desc", DropDownList_Teacher, "X_Manager_User", "X_Manager_User");
            DB.Bind_Dropdownlist("select * from X_Course order by X_ID desc", DropDownList_Course, "X_Course_Name", "X_Course_Name");
            DB.Bind_Dropdownlist("select * from X_Class order by X_ID desc", DropDownList_Class, "X_ID", "X_Class_Name");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql2 = "insert into X_Lesson(X_Class_ID,X_Month,X_Subsidy,X_Manager_User,X_Course_Name,X_Price,X_Total,X_Othor)values(" + DropDownList_Class.SelectedValue + ",'" + DropDownList_Month.SelectedValue + "'," + txt_butie.Text + ",'" + DropDownList_Teacher.SelectedValue + "','" + DropDownList_Course.SelectedValue + "',"+txt_price.Text.Trim()+","+txt_total.Text.Trim()+","+txt_othor.Text.Trim()+")";
        try
        {
            OleDbConnection cn = DB.OpenConnection();
            OleDbCommand cmd = new OleDbCommand(sql2, cn);
            cmd.ExecuteNonQuery();
            cn.Close();
            cn.Dispose();
            Common.ShowMessage(this.Page, "添加成功!", "");
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
}

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

AI 解读 AI

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

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