showkaoshi.aspx.cs

来自「一个办公管理系统完整版」· CS 代码 · 共 78 行

CS
78
字号
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 OfficeSys.showInfo
{
	/// <summary>
	/// showKaoshi 的摘要说明。
	/// </summary>
	public class showKaoshi : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if(Session["id"]==null)
			{
				Response.Redirect("../login.aspx");
			}
			Class.DataProcess  dataProcess=new Class.DataProcess( );
			SqlConnection sqlConnection=new SqlConnection(dataProcess.getSqlConn( ));
			string strSql="select 考试表.学生号,考试时间表.考试时间,班级信息表.班级名,教室信息表.教室名,科目信息表.科目名,考试表.主考教师,考试表.辅考教师 from 考试表,班级信息表,考试时间表,教室信息表,科目信息表,教师信息表 where 考试表.考试时间号=考试时间表.考试时间号 and 考试表.班级号=班级信息表.班级号 and 教室信息表.教室号=考试表.教室号 and 科目信息表.科目号=考试表.科目号 and 考试表.主考教师=教师信息表.教师名 ";
			DataSet set=new DataSet( );
			SqlDataAdapter adapter=new SqlDataAdapter(strSql,sqlConnection);
			adapter.Fill(set,"class");
			this.DataGrid1.DataSource=set.Tables["class"].DefaultView;
			this.DataBind( );
		}

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


		}
		#endregion

		private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}
		private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
		{
			this.DataGrid1.CurrentPageIndex=e.NewPageIndex;			
			this.DataGrid1.DataBind( );
		
		
		
		}
	}
}

⌨️ 快捷键说明

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