Admin/shipinManage.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_shipinManage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();//加载数据
}
}
private void BindData()
{
string sql;
sql = "select * from shipin where jiaoshiID=" + Session["jiaoshiID"].ToString() + "";//查询所有测试题目
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 shipin where ID=" + id + " ";//按照ID删除
int result = LinkDB.ExecuteSql(sql);
if (result == 1)
{
Response.Write("<script>javascript:alert('删除成功');</script>");
BindData();
}
else
{
Response.Write("<script>javascript:alert('系统错误,请检查数据库设置问题');</script>");
}
}
protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
后面还有 5 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
