Homework/Admin/Students.aspx.cs

(开头部分) 4KB

这里只显示每个文件的开头 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;
using dbClass;
using System.Data.SqlClient;

namespace Homework.Admin
{
    public partial class Students : System.Web.UI.Page
    {
        Alert alert = new Alert();
        SqlHelper data = new SqlHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                    InitData();
                    GetJiaoyanshi();
            


            }
        }
        private void GetJiaoyanshi()
        {

            DropDownList1.DataSource = data.GetDataReader("select * from  Class");
            DropDownList1.DataTextField = "Bname";
            DropDownList1.DataValueField = "id";
            DropDownList1.DataBind();

        }
        protected void InitData()
        {
            SqlHelper mydata = new SqlHelper();
            GridView1.DataSource = mydata.GetDataReader("select * from Student");
            GridView1.DataBind();
        }
        //GridView控件RowDeleting事件
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            SqlHelper mydata = new SqlHelper();

            string ID = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
            try
            {
                mydata.RunSql("delete  from Student  where  id='" + ID + "'");

                Label4.Text = "删除成功!";
                GridView1.EditIndex = -1;
                InitData();
            }
后面还有 79 行代码,购买后查看完整代码

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

AI 解读 AI

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

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