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

📄 form_kckcx.cs

📁 一个很简单的考试系统。实用性很强啊!数据库在里面
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient; 
namespace bizdb
{
	/// <summary>
	/// Form_kccx 的摘要说明。
	/// </summary>
	public class Form_kckcx : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox gpb_cxfs;
		private System.Windows.Forms.RadioButton rdb_akccx;
		private System.Windows.Forms.RadioButton rdb_ajxdycx;
		private System.Windows.Forms.Label lbl_qsrkcjd;
		private System.Windows.Forms.Label lbl_qsrkcsl;
		private System.Windows.Forms.GroupBox gpb_kcjd;
		private System.Windows.Forms.RadioButton rdb_dyjd;
		private System.Windows.Forms.RadioButton rdb_dejd;
		private System.Windows.Forms.RadioButton rdb_dsjd;
		private System.Windows.Forms.ComboBox cbb_kcsl;
		private System.Windows.Forms.CheckBox ckb_sfgljxdy;
		private System.Windows.Forms.Button btn_cx;
		private System.Windows.Forms.Panel pnl_kckcx;
		private System.Windows.Forms.DataGrid dgd_kc;
		private System.Windows.Forms.DataGrid dgd_jxdy;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form_kckcx()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.gpb_cxfs = new System.Windows.Forms.GroupBox();
			this.rdb_ajxdycx = new System.Windows.Forms.RadioButton();
			this.rdb_akccx = new System.Windows.Forms.RadioButton();
			this.pnl_kckcx = new System.Windows.Forms.Panel();
			this.btn_cx = new System.Windows.Forms.Button();
			this.ckb_sfgljxdy = new System.Windows.Forms.CheckBox();
			this.cbb_kcsl = new System.Windows.Forms.ComboBox();
			this.gpb_kcjd = new System.Windows.Forms.GroupBox();
			this.rdb_dsjd = new System.Windows.Forms.RadioButton();
			this.rdb_dejd = new System.Windows.Forms.RadioButton();
			this.rdb_dyjd = new System.Windows.Forms.RadioButton();
			this.lbl_qsrkcsl = new System.Windows.Forms.Label();
			this.lbl_qsrkcjd = new System.Windows.Forms.Label();
			this.dgd_kc = new System.Windows.Forms.DataGrid();
			this.dgd_jxdy = new System.Windows.Forms.DataGrid();
			this.gpb_cxfs.SuspendLayout();
			this.pnl_kckcx.SuspendLayout();
			this.gpb_kcjd.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dgd_kc)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dgd_jxdy)).BeginInit();
			this.SuspendLayout();
			// 
			// gpb_cxfs
			// 
			this.gpb_cxfs.Controls.AddRange(new System.Windows.Forms.Control[] {
																				   this.rdb_ajxdycx,
																				   this.rdb_akccx});
			this.gpb_cxfs.Location = new System.Drawing.Point(8, 8);
			this.gpb_cxfs.Name = "gpb_cxfs";
			this.gpb_cxfs.Size = new System.Drawing.Size(280, 48);
			this.gpb_cxfs.TabIndex = 0;
			this.gpb_cxfs.TabStop = false;
			this.gpb_cxfs.Text = "查询方式";
			// 
			// rdb_ajxdycx
			// 
			this.rdb_ajxdycx.Location = new System.Drawing.Point(152, 16);
			this.rdb_ajxdycx.Name = "rdb_ajxdycx";
			this.rdb_ajxdycx.Size = new System.Drawing.Size(112, 24);
			this.rdb_ajxdycx.TabIndex = 1;
			this.rdb_ajxdycx.Text = "按教学单元查询";
			// 
			// rdb_akccx
			// 
			this.rdb_akccx.Checked = true;
			this.rdb_akccx.Location = new System.Drawing.Point(16, 16);
			this.rdb_akccx.Name = "rdb_akccx";
			this.rdb_akccx.TabIndex = 0;
			this.rdb_akccx.TabStop = true;
			this.rdb_akccx.Text = "按课程查询";
			this.rdb_akccx.CheckedChanged += new System.EventHandler(this.rdb_akccx_CheckedChanged);
			// 
			// pnl_kckcx
			// 
			this.pnl_kckcx.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.btn_cx,
																					this.ckb_sfgljxdy,
																					this.cbb_kcsl,
																					this.gpb_kcjd,
																					this.lbl_qsrkcsl,
																					this.lbl_qsrkcjd,
																					this.gpb_cxfs});
			this.pnl_kckcx.Dock = System.Windows.Forms.DockStyle.Top;
			this.pnl_kckcx.Name = "pnl_kckcx";
			this.pnl_kckcx.Size = new System.Drawing.Size(792, 104);
			this.pnl_kckcx.TabIndex = 1;
			// 
			// btn_cx
			// 
			this.btn_cx.Location = new System.Drawing.Point(656, 16);
			this.btn_cx.Name = "btn_cx";
			this.btn_cx.TabIndex = 5;
			this.btn_cx.Text = "查询";
			this.btn_cx.Click += new System.EventHandler(this.btn_cx_Click);
			// 
			// ckb_sfgljxdy
			// 
			this.ckb_sfgljxdy.Checked = true;
			this.ckb_sfgljxdy.CheckState = System.Windows.Forms.CheckState.Checked;
			this.ckb_sfgljxdy.Location = new System.Drawing.Point(656, 64);
			this.ckb_sfgljxdy.Name = "ckb_sfgljxdy";
			this.ckb_sfgljxdy.Size = new System.Drawing.Size(128, 24);
			this.ckb_sfgljxdy.TabIndex = 4;
			this.ckb_sfgljxdy.Text = "是否关联教学单元";
			this.ckb_sfgljxdy.CheckedChanged += new System.EventHandler(this.ckb_sfgljxdy_CheckedChanged);
			// 
			// cbb_kcsl
			// 
			this.cbb_kcsl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cbb_kcsl.Location = new System.Drawing.Point(120, 64);
			this.cbb_kcsl.Name = "cbb_kcsl";
			this.cbb_kcsl.Size = new System.Drawing.Size(168, 20);
			this.cbb_kcsl.TabIndex = 3;
			this.cbb_kcsl.SelectedIndexChanged += new System.EventHandler(this.cbb_kcsl_SelectedIndexChanged);
			// 
			// gpb_kcjd
			// 
			this.gpb_kcjd.Controls.AddRange(new System.Windows.Forms.Control[] {
																				   this.rdb_dsjd,
																				   this.rdb_dejd,
																				   this.rdb_dyjd});
			this.gpb_kcjd.Location = new System.Drawing.Point(392, 48);
			this.gpb_kcjd.Name = "gpb_kcjd";
			this.gpb_kcjd.Size = new System.Drawing.Size(256, 48);
			this.gpb_kcjd.TabIndex = 2;
			this.gpb_kcjd.TabStop = false;
			this.gpb_kcjd.Text = "课程阶段";
			// 
			// rdb_dsjd
			// 
			this.rdb_dsjd.Location = new System.Drawing.Point(176, 16);
			this.rdb_dsjd.Name = "rdb_dsjd";
			this.rdb_dsjd.Size = new System.Drawing.Size(72, 24);
			this.rdb_dsjd.TabIndex = 2;
			this.rdb_dsjd.Text = "第三阶段";
			this.rdb_dsjd.CheckedChanged += new System.EventHandler(this.rdb_dsjd_CheckedChanged);
			// 
			// rdb_dejd
			// 
			this.rdb_dejd.Location = new System.Drawing.Point(92, 16);
			this.rdb_dejd.Name = "rdb_dejd";
			this.rdb_dejd.Size = new System.Drawing.Size(72, 24);
			this.rdb_dejd.TabIndex = 1;
			this.rdb_dejd.Text = "第二阶段";
			this.rdb_dejd.CheckedChanged += new System.EventHandler(this.rdb_dejd_CheckedChanged);
			// 
			// rdb_dyjd
			// 
			this.rdb_dyjd.Checked = true;
			this.rdb_dyjd.Location = new System.Drawing.Point(8, 16);
			this.rdb_dyjd.Name = "rdb_dyjd";
			this.rdb_dyjd.Size = new System.Drawing.Size(72, 24);
			this.rdb_dyjd.TabIndex = 0;
			this.rdb_dyjd.TabStop = true;
			this.rdb_dyjd.Text = "第一阶段";
			this.rdb_dyjd.CheckedChanged += new System.EventHandler(this.rdb_dyjd_CheckedChanged);
			// 
			// lbl_qsrkcsl
			// 
			this.lbl_qsrkcsl.Location = new System.Drawing.Point(8, 64);
			this.lbl_qsrkcsl.Name = "lbl_qsrkcsl";
			this.lbl_qsrkcsl.TabIndex = 1;
			this.lbl_qsrkcsl.Text = "请输入课程属类";
			// 
			// lbl_qsrkcjd
			// 
			this.lbl_qsrkcjd.Location = new System.Drawing.Point(288, 64);
			this.lbl_qsrkcjd.Name = "lbl_qsrkcjd";
			this.lbl_qsrkcjd.TabIndex = 0;
			this.lbl_qsrkcjd.Text = "请输入课程阶段";
			// 
			// dgd_kc
			// 
			this.dgd_kc.DataMember = "";
			this.dgd_kc.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dgd_kc.Location = new System.Drawing.Point(0, 104);
			this.dgd_kc.Name = "dgd_kc";
			this.dgd_kc.ReadOnly = true;
			this.dgd_kc.Size = new System.Drawing.Size(792, 216);
			this.dgd_kc.TabIndex = 2;
			this.dgd_kc.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgd_kc_MouseDown);
			this.dgd_kc.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgd_kc_MouseUp);
			// 
			// dgd_jxdy
			// 
			this.dgd_jxdy.DataMember = "";
			this.dgd_jxdy.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dgd_jxdy.Location = new System.Drawing.Point(0, 328);
			this.dgd_jxdy.Name = "dgd_jxdy";
			this.dgd_jxdy.ReadOnly = true;
			this.dgd_jxdy.Size = new System.Drawing.Size(792, 232);
			this.dgd_jxdy.TabIndex = 3;
			this.dgd_jxdy.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgd_jxdy_MouseUp);
			// 
			// Form_kckcx
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(792, 573);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.dgd_jxdy,
																		  this.dgd_kc,
																		  this.pnl_kckcx});
			this.Name = "Form_kckcx";
			this.Text = "课程库查询";
			this.Load += new System.EventHandler(this.Form_kccx_Load);
			this.gpb_cxfs.ResumeLayout(false);
			this.pnl_kckcx.ResumeLayout(false);
			this.gpb_kcjd.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dgd_kc)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dgd_jxdy)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		public SqlConnection sqlcnt = new SqlConnection();

		SqlDataAdapter sqldpt_kckcx1 = new SqlDataAdapter();
		DataSet dst_kckcx1 = new DataSet();
		SqlDataAdapter sqldpt_kckcx2 = new SqlDataAdapter ();
		DataSet dst_kckcx2 = new DataSet();
		SqlDataAdapter sqldpt_kckcx3 = new SqlDataAdapter ();
		DataSet dst_kckcx3 = new DataSet ();

		SqlDataAdapter sqldpt_kckcx = new SqlDataAdapter ();
		DataSet dst_kckcx = new DataSet ();

		SqlCommand sqlcmd = new SqlCommand ();

		int i =0; // 判断标志,1 按课程查询,2 按教学单元查询
		int level = 0;//level 课程阶段 1,2,3阶段
		int kind = 0; //kind课程属类 1基础课 2公共课 3专业课 4其他
		int k = 0;//是否关联~~~1表示关联 2表示不关联

		private void Form_kccx_Load(object sender, System.EventArgs e)
		{
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.ControlBox = false;
			sqlcnt.ConnectionString = dbAccess.conn ;
			i = 1;
			cbb_kcsl.Items.Clear();
			cbb_kcsl.Items.Add("基础课");
			cbb_kcsl.Items.Add("公共课");
			cbb_kcsl.Items.Add("专业课");
			cbb_kcsl.Items.Add("其他");
			cbb_kcsl.SelectedIndex = 0;
			level = 1;
			kind = 1;
			k = 1;
			try
			{
				sqlcnt.Open();
							
			}
			catch
			{
				MessageBox.Show("服务器连接出错","阜和教育课程体系试题库系统提示");
				return;                
			}
			sqlcmd.CommandText="select cou_name from course";
			sqlcmd.Connection = sqlcnt;
			sqldpt_kckcx.SelectCommand = sqlcmd;
			sqldpt_kckcx.Fill (dst_kckcx);

			sqlcnt.Close ();
		}
		private void guanlian()
		{
			if (dgd_kc.CurrentRowIndex == -1)
			{
				return;
			}
			if (k ==1)
			{	
				this.dst_kckcx2.Clear ();
				int cou_no = int.Parse(this.dst_kckcx1.Tables[0].Rows[dgd_kc.CurrentRowIndex][0].ToString ());
				sqlcmd.CommandText = "select * from teachingunit where cou_no = "+ cou_no;
				sqlcmd.Connection = sqlcnt;
				this.sqldpt_kckcx2.SelectCommand = sqlcmd;
				this.sqldpt_kckcx2.Fill(dst_kckcx2,"table2");
					
				if (this.dst_kckcx2.Tables[0].Rows.Count != 0 )
				{
						
					this.dgd_jxdy.TableStyles.Clear ();	
					DataGridTableStyle style2 = new DataGridTableStyle ();
					style2.MappingName = "table2";

					DataGridTextBoxColumn teau_name = new DataGridTextBoxColumn();
					teau_name.HeaderText = "教学单元名称";
					teau_name.MappingName ="teau_name";
					teau_name.Width = 100;

					DataGridTextBoxColumn teau_diffcult = new DataGridTextBoxColumn ();
					teau_diffcult.HeaderText = "教学单元出题量比重(难)";
					teau_diffcult.MappingName = "teau_diffcult";
					teau_diffcult.Width = 150;

					DataGridTextBoxColumn teau_normal = new DataGridTextBoxColumn ();
					teau_normal.HeaderText ="教学单元出题量比重(中)";
					teau_normal.MappingName ="teau_normal";
					teau_normal.Width = 150;

					DataGridTextBoxColumn teau_easy = new DataGridTextBoxColumn ();

⌨️ 快捷键说明

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