?? 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 + -