Admin/huoshiManage.aspx.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Admin_huoshiManage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindData();//数据加载
        }
    }
    private void BindData()
    {
        string sql;
        sql = "select * from huoshi where 1>0";//查询所有课程信息
        if (this.riqi.Text != "")
        {
            sql += " and riqi='" + this.riqi.Text + "'";
        }
        DataSet ds = LinkDB.Query(sql);//执行查询语句
        DataGrid1.DataSource = ds.Tables[0];
        DataGrid1.DataKeyField = "ID";

        DataGrid1.DataBind();

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        BindData();
    }

    protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
    {
        DataGrid1.CurrentPageIndex = e.NewPageIndex;
        BindData();
    }
    protected void DataGrid1_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        int index = e.Item.ItemIndex;
        string id = this.DataGrid1.DataKeys[index].ToString().Trim();//获取主键伙食ID
        string sql;
        sql = "delete from huoshi where ID=" + id + " ";//删除伙食信息的SQL语句
        int result = LinkDB.ExecuteSql(sql);//执行删除语句
        if (result == 1)
        {
            Response.Write("<script>javascript:alert('删除成功');</script>");

            BindData();
        }
        else
        {
            Response.Write("<script>javascript:alert('系统错误,请检查数据库设置问题');</script>");
        }
后面还有 14 行代码,购买后查看完整代码

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

AI 解读 AI

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

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