showvote.ascx.cs

来自「酒店管理系统」· CS 代码 · 共 67 行

CS
67
字号
namespace hotel.Continer
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.Data.SqlClient;

	/// <summary>
	///		showvote 的摘要说明。
	/// </summary>
	public class showvote : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Label Label5;
		protected System.Web.UI.WebControls.Label Label4;

		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			SqlConnection con=DB.createCon();
	
	
			con.Open();
			SqlCommand cmd=new SqlCommand("select votenum from vote where voteid='1'",con);
			this.Label1.Text=Convert.ToString(cmd.ExecuteScalar());
			SqlCommand cmd1=new SqlCommand("select votenum from vote where voteid='2'",con);
			this.Label2.Text=Convert.ToString(cmd1.ExecuteScalar());
			SqlCommand cmd2=new SqlCommand("select votenum from vote where voteid='3'",con);
			this.Label3.Text=Convert.ToString(cmd2.ExecuteScalar());
			SqlCommand cmd3=new SqlCommand("select votenum from vote where voteid='4'",con);
			this.Label4.Text=Convert.ToString(cmd3.ExecuteScalar());
			SqlCommand cmd4=new SqlCommand("select cotesum from cotesum where cotesumid='1'",con);
			this.Label5.Text=Convert.ToString(cmd4.ExecuteScalar());




		}

		#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 + =
减小字号Ctrl + -
显示快捷键?