⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookmanage.aspx.cs

📁 book shop system how to sell and buy online
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration ;
using System.Data .SqlClient ;

namespace BMS
{
	/// <summary>
	/// BookManage 
	/// </summary>
	public partial class BookManage : System.Web.UI.Page
	{
	
		protected void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack) BindGrid();
		}

		public void DataGrid_Delete(Object sender,DataGridCommandEventArgs E)
		{
            //from the file Web.config Read connecting string 
			string strconn = "server=ABUOSAMA; uid=sa; database=BMS";
			//CONNECT WITH THE BMS DATABASE
			SqlConnection cn= new SqlConnection (strconn);
			cn.Open ();
			//CREATE cm1,USING book TABLE DATA
			SqlCommand cm1=new SqlCommand ("bookdelete",cn);
			cm1.Parameters .Add ("@BID",SqlDbType.Int  );
			cm1.CommandType =CommandType.StoredProcedure ;
			//CREATE cm2,USING bookprice TABLE DATA
			SqlCommand cm2=new SqlCommand ("bookpricedelete",cn);
			cm2.Parameters .Add ("@PPID",SqlDbType.Int  );
			cm2.CommandType =CommandType.StoredProcedure ;
			//FROM DateGrid UPDATE DATA
			//Cells [1]TO BID
			string bidvalue=E.Item.Cells [1].Text.ToString ();
			cm1.Parameters ["@BID"].Value =Convert.ToInt16 (bidvalue);
			cm2.Parameters ["@PPID"].Value =Convert.ToInt16 (bidvalue);
			cm1.ExecuteNonQuery ();
			cm2.ExecuteNonQuery ();
			dgd_booklist.EditItemIndex =-1;
			cn.Close ();
			BindGrid();
		}
		public void DataGrid_Page(Object sender,DataGridPageChangedEventArgs E)
		{
			dgd_booklist.CurrentPageIndex =E.NewPageIndex ;
			BindGrid();
		}

		public void BindGrid()
        {	////from the file Web.config Read connecting string 
			string strconn = "server=ABUOSAMA; uid=sa; database=BMS";
            //CONNECT WITH THE BMS DATABASE
			SqlConnection cn= new SqlConnection (strconn);
			//CREATE SqlDataAdapter 
			SqlDataAdapter da=new SqlDataAdapter ("booklist",cn);
			//CREATE DataSet
			DataSet ds=new DataSet ();
			da.Fill (ds);
			dgd_booklist.DataSource =ds;
			dgd_booklist.DataBind ();
			cn.Close ();
		}
		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{ 

		}
		#endregion

		protected void btn_search_Click(object sender, System.EventArgs e)
		{	int varbid=Convert.ToInt16 (tbx_bid.Text .ToString ());
			Response.Redirect ("bookmodify.aspx?bid="+varbid);
		}

		protected void dgd_booklist_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -