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

📄 stmanagerdep_prod.aspx.cs

📁 连锁配送中心系统
💻 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.Data.SqlClient;
using System.Configuration;

namespace STcontract.Manager
{
	/// <summary>
	/// ManagerDep_Prod 的摘要说明。
	/// </summary>
	public class ManagerDep_Prod : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.DataGrid STmyGrid;

		SqlConnection STconn;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(Session["STNickName"] != null)
			{
				//获得数据库连接字符串
				string STconnection = ConfigurationSettings.AppSettings["strconnection"];
				STconn = new SqlConnection(STconnection);

				if(!IsPostBack)
				{
					//自定义BindGrid ()方法,加载连锁店销售的信息
					BindGrid();
				}
			}
			else
			{
				Response.Redirect("../Index.aspx");
			}
		}

		//处理分页
		public void STmyGrid_Page(object sender,DataGridPageChangedEventArgs e)
		{
			//获取DataGrid的当前显示页的索引
			STmyGrid.CurrentPageIndex=e.NewPageIndex;
			BindGrid();
		}

		//加载连锁店销售的信息
		public void BindGrid()
		{
			//创建查询连锁店销售信息的sql语句
			string STstrsql="select STSale.ID,STDep.STDepName,STProdName,STSale.STSaleNum,STSale.STStartTime,STSale.STEndTime from STSale,STDep,STProd where STSale.STProdID = STProd.STProdID and STSale.STDepID = STDep.STDepID";
			//创建SqlDataAdapter的实例
			SqlDataAdapter STsda=new SqlDataAdapter(STstrsql,STconn);
			//创建DataSet的实例
			DataSet STds=new DataSet();
			//将信息填充到DataSet
			STsda.Fill(STds);
			//获取DataGrid的数据源
			STmyGrid.DataSource = STds;
			//将信息绑定到DataGrid
			STmyGrid.DataBind();
		
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion



	}
}

⌨️ 快捷键说明

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