📄 admin_salelist.aspx.cs
字号:
using System;
using System.Data;
using System.Data.OleDb;
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 Admin_Admin_SaleList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserID"] == "" || Session["UserID"] == null)
{
Response.Write("<script language=javascript>window.alert('为了系统安全,请您重新登陆');window.location.href=('Admin_Login.aspx')</script>");
}
if (!IsPostBack)
{
this.DataToBind();
}
}
public void DataToBind()
{
OleDbConnection myconn = DB.CreateDB();
myconn.Open();
OleDbCommand cmd = new OleDbCommand("select * from sale_net", myconn);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds, "sale_net");
this.GirdList.DataSource = ds;
this.GirdList.DataKeyField = "id";
this.GirdList.DataBind();
myconn.Close();
}
protected void GirdList_DeleteCommand(object source, DataGridCommandEventArgs e)
{
OleDbConnection myconn = DB.CreateDB();
myconn.Open();
string id = GirdList.DataKeys[e.Item.ItemIndex].ToString();
OleDbCommand cmd = new OleDbCommand("delete * from sale_net where id="+id, myconn);
cmd.ExecuteNonQuery();
myconn.Close();
Response.Write("<script language=javascript>window.alert('删除成功,单击确定返回列表页面');window.location.href=('Admin_SaleList.aspx');</script>");
}
protected void GirdList_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
this.GirdList.CurrentPageIndex = e.NewPageIndex;
this.DataToBind();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -