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

📄 fenxijb.aspx.cs

📁 这是一个基于WEB的电场耗水量管理与分析系统
💻 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;
namespace nicholasbjj
{
	/// <summary>
	/// Summary description for fenxi.
	/// </summary>
	public class fenxi : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Button Button3;
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
		protected System.Web.UI.WebControls.Label Labeltime;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.Label Label7;
		protected System.Web.UI.WebControls.Label Label8;
		protected System.Web.UI.WebControls.Label Label13;
		protected System.Web.UI.WebControls.Label Label14;
		protected System.Web.UI.WebControls.Label Label15;
		protected System.Web.UI.WebControls.Label Label16;
		protected System.Web.UI.WebControls.Label Label19;
		protected System.Web.UI.WebControls.Label Label20;
		protected System.Web.UI.WebControls.Label Label21;
		protected System.Web.UI.WebControls.Label Label26;
		protected System.Web.UI.WebControls.Label Label28;
		protected System.Web.UI.WebControls.Label Label29;
		protected System.Web.UI.WebControls.Label Label30;
		protected System.Web.UI.WebControls.Label Label31;
		protected System.Web.UI.WebControls.Label Label32;
		protected System.Web.UI.WebControls.Label Label5;
		protected System.Web.UI.WebControls.Label Label17;
		protected System.Web.UI.WebControls.Label Label6;
		protected System.Web.UI.WebControls.Label Label1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Button3.Click += new System.EventHandler(this.Button3_Click);
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button1_Click(object sender, System.EventArgs e)
		{
			try
			{
				string strConn="Server=(local);User ID=sa;Database=bjj;PassWord=temo456;";
				SqlConnection conn=new SqlConnection(strConn);
				SqlCommand cmd=new SqlCommand();
				SqlDataReader reader;
				cmd.Connection=conn;
				cmd.CommandType=CommandType.StoredProcedure;
				cmd.CommandText="fenxijb";			
				cmd.Parameters.Add("@szb_Time",DropDownList1.SelectedValue);
				cmd.Parameters["@szb_Time"].Value=DropDownList1.SelectedValue;
				conn.Open();
				reader=cmd.ExecuteReader();
				DataGrid1.DataSource=reader;
				DataGrid1.DataBind();

				Labeltime.Text=this.DropDownList1.SelectedValue;
				Label2.Text=this.DropDownList1.SelectedValue;
				Label31.Text=this.DropDownList1.SelectedValue;
				string sel="SELECT SUM(CAST(ysj AS int) - CAST(yjh AS int)) AS Expr1 FROM szbsj WHERE (comid = 1) and (szbid=1 or szbid=3 or szbid=5) and [time]='"+this.DropDownList1.SelectedValue+"'";
				Label3.Text=this.GetValueFromSql(sel);
				string sel1="SELECT SUM(CAST(ysj AS int) - CAST(yjh AS int)) AS Expr2 FROM szbsj WHERE (comid = 1) and (szbid=2 or szbid=4 or szbid=6) and [time]='"+this.DropDownList1.SelectedValue+"'";
				Label21.Text=this.GetValueFromSql(sel1);
				string sel2="SELECT sjz AS int FROM szbsj WHERE (comid =1) and (szbid=1 or szbid=3 or szbid=5) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label29.Text=this.GetValueFromSql(sel2);
				string sel3="SELECT sjz AS int FROM szbsj WHERE (comid =1) and (szbid=2 or szbid=4 or szbid=6) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label30.Text=this.GetValueFromSql(sel3);
				string sel4="SELECT SUM(CAST(yjh AS int) - CAST(ysj AS int)) AS Expr3 FROM szbsj WHERE (comid =1) and (szbid=18) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label28.Text=this.GetValueFromSql(sel4);
				string sel5="SELECT SUM(CAST(yjh AS int) - CAST(ysj AS int)) AS Expr4 FROM szbsj WHERE (comid =1) and (szbid=18) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label4.Text=this.GetValueFromSql(sel5);
				string sel6="SELECT SUM(CAST(ysj AS int) - CAST(yjh AS int)) AS Expr5 FROM szbsj WHERE (comid = 2) and (szbid=1 or szbid=3 or szbid=5) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label7.Text=this.GetValueFromSql(sel6);
				string sel7="SELECT SUM(CAST(ysj AS int) - CAST(yjh AS int)) AS Expr6 FROM szbsj WHERE (comid = 2) and (szbid=2 or szbid=4 or szbid=6) and [time]='"+this.DropDownList1.SelectedValue+"'";
				Label8.Text=this.GetValueFromSql(sel7);
				string sel8="SELECT sjz AS int FROM szbsj WHERE (comid =3) and (szbid=9) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label13.Text=this.GetValueFromSql(sel8);
				string sel9="SELECT sjz AS int FROM szbsj WHERE (comid =3) and (szbid=10) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label14.Text=this.GetValueFromSql(sel9);
				string sel10="SELECT sjz AS int FROM szbsj WHERE (comid =3) and (szbid=11) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label15.Text=this.GetValueFromSql(sel10);
				string sel11="SELECT sjz AS int FROM szbsj WHERE (comid =3) and (szbid=1 or szbid=3 or szbid=5) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label5.Text=this.GetValueFromSql(sel11);
				string sel12="SELECT sjz AS int FROM szbsj WHERE (comid =3) and (szbid=20) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label16.Text=this.GetValueFromSql(sel12);
				string sel13="SELECT SUM(CAST(ysj AS int) - CAST(yjh AS int)) AS Expr1 FROM szbsj WHERE (comid = 3) and (szbid=1 or szbid=3 or szbid=5) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label17.Text=this.GetValueFromSql(sel13);
				string sel14="SELECT SUM(CAST(ysj AS int)) AS Expr1 FROM szbsj WHERE (comid = 4) and (szbid=17 or szbid=19) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label19.Text=this.GetValueFromSql(sel14);
				string sel15="SELECT SUM(CAST(ysj AS int) - CAST(yjh AS int)) AS Expr1 FROM szbsj WHERE (comid = 4) and (szbid=17 or szbid=19) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label20.Text=this.GetValueFromSql(sel15);
				string sel16="SELECT sjz AS int FROM szbsj WHERE (comid =5) and (szbid=14) and [time]='"+this.DropDownList1.SelectedValue+"'"; 
				Label6.Text=this.GetValueFromSql(sel16);
			}
			catch{}
		}
		private string GetValueFromSql(string sql)
		{
			string res="";
			string strConn="Server=(local);User ID=sa;Database=bjj;PassWord=temo456;";
			SqlConnection conn=new SqlConnection(strConn);
			SqlCommand cmd=new SqlCommand();
			SqlDataReader reader;
			cmd.Connection=conn;
			cmd.CommandText=sql;			
			conn.Open();
			reader=cmd.ExecuteReader();
			reader.Read();
			res=reader[0].ToString();
			reader.Close();
			conn.Close();
			return res;
		}
		private void Button3_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("zhujiemian.aspx");
		}
	}
}

⌨️ 快捷键说明

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