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

📄 form_jxdy.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_jxdy 的摘要说明。
	/// </summary>
	public class Form_jxdy : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label lbl_qsrkcm;
		private System.Windows.Forms.ComboBox cbb_kcm;
		private System.Windows.Forms.Button btn_qd;
		private System.Windows.Forms.Label lbl_jxdymc;
		private System.Windows.Forms.Label lbl_nttl;
		private System.Windows.Forms.Label lbl_zttl;
		private System.Windows.Forms.Label lbl_yttl;
		private System.Windows.Forms.TextBox txt_yttl;
		private System.Windows.Forms.TextBox txt_zttl;
		private System.Windows.Forms.TextBox txt_nttl;
		private System.Windows.Forms.TextBox txt_jxdymc;
		private System.Windows.Forms.Label lbl_zsdsm;
		private System.Windows.Forms.TextBox txt_zsdsm;
		private System.Windows.Forms.Button btn_qx;
		private System.Windows.Forms.Button btn_qdtj;
		private System.Windows.Forms.Button btn_sc;
		private System.Windows.Forms.Button btn_tj;
		private System.Windows.Forms.Button btn_bj;
		private System.Windows.Forms.Button btn_mjl;
		private System.Windows.Forms.Button btn_hyjr;
		private System.Windows.Forms.Button btn_qyjr;
		private System.Windows.Forms.Button btn_sjr;
		private System.Windows.Forms.DataGrid dgd_jxdy;
		private System.Windows.Forms.Panel pnl_jxdy1;
		private System.Windows.Forms.Panel pnl_jxdy2;
		private System.Windows.Forms.Panel pnl_jxdy3;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form_jxdy()
		{
			//
			// 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.pnl_jxdy1 = new System.Windows.Forms.Panel();
			this.btn_qd = new System.Windows.Forms.Button();
			this.cbb_kcm = new System.Windows.Forms.ComboBox();
			this.lbl_qsrkcm = new System.Windows.Forms.Label();
			this.dgd_jxdy = new System.Windows.Forms.DataGrid();
			this.pnl_jxdy2 = new System.Windows.Forms.Panel();
			this.txt_zsdsm = new System.Windows.Forms.TextBox();
			this.lbl_zsdsm = new System.Windows.Forms.Label();
			this.txt_yttl = new System.Windows.Forms.TextBox();
			this.txt_zttl = new System.Windows.Forms.TextBox();
			this.txt_nttl = new System.Windows.Forms.TextBox();
			this.txt_jxdymc = new System.Windows.Forms.TextBox();
			this.lbl_yttl = new System.Windows.Forms.Label();
			this.lbl_zttl = new System.Windows.Forms.Label();
			this.lbl_nttl = new System.Windows.Forms.Label();
			this.lbl_jxdymc = new System.Windows.Forms.Label();
			this.pnl_jxdy3 = new System.Windows.Forms.Panel();
			this.btn_qx = new System.Windows.Forms.Button();
			this.btn_qdtj = new System.Windows.Forms.Button();
			this.btn_sc = new System.Windows.Forms.Button();
			this.btn_tj = new System.Windows.Forms.Button();
			this.btn_bj = new System.Windows.Forms.Button();
			this.btn_mjl = new System.Windows.Forms.Button();
			this.btn_hyjr = new System.Windows.Forms.Button();
			this.btn_qyjr = new System.Windows.Forms.Button();
			this.btn_sjr = new System.Windows.Forms.Button();
			this.pnl_jxdy1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dgd_jxdy)).BeginInit();
			this.pnl_jxdy2.SuspendLayout();
			this.pnl_jxdy3.SuspendLayout();
			this.SuspendLayout();
			// 
			// pnl_jxdy1
			// 
			this.pnl_jxdy1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.pnl_jxdy1.Controls.Add(this.btn_qd);
			this.pnl_jxdy1.Controls.Add(this.cbb_kcm);
			this.pnl_jxdy1.Controls.Add(this.lbl_qsrkcm);
			this.pnl_jxdy1.Location = new System.Drawing.Point(0, 0);
			this.pnl_jxdy1.Name = "pnl_jxdy1";
			this.pnl_jxdy1.Size = new System.Drawing.Size(792, 56);
			this.pnl_jxdy1.TabIndex = 0;
			this.pnl_jxdy1.Paint += new System.Windows.Forms.PaintEventHandler(this.pnl_jxdy1_Paint);
			// 
			// btn_qd
			// 
			this.btn_qd.Location = new System.Drawing.Point(440, 16);
			this.btn_qd.Name = "btn_qd";
			this.btn_qd.TabIndex = 2;
			this.btn_qd.Text = "确定";
			this.btn_qd.Click += new System.EventHandler(this.btn_qd_Click);
			// 
			// cbb_kcm
			// 
			this.cbb_kcm.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cbb_kcm.Location = new System.Drawing.Point(112, 16);
			this.cbb_kcm.Name = "cbb_kcm";
			this.cbb_kcm.Size = new System.Drawing.Size(272, 20);
			this.cbb_kcm.TabIndex = 1;
			this.cbb_kcm.SelectedIndexChanged += new System.EventHandler(this.cbb_kcm_SelectedIndexChanged);
			// 
			// lbl_qsrkcm
			// 
			this.lbl_qsrkcm.Location = new System.Drawing.Point(8, 16);
			this.lbl_qsrkcm.Name = "lbl_qsrkcm";
			this.lbl_qsrkcm.TabIndex = 0;
			this.lbl_qsrkcm.Text = "请输入课程名";
			// 
			// dgd_jxdy
			// 
			this.dgd_jxdy.DataMember = "";
			this.dgd_jxdy.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dgd_jxdy.Location = new System.Drawing.Point(0, 56);
			this.dgd_jxdy.Name = "dgd_jxdy";
			this.dgd_jxdy.ReadOnly = true;
			this.dgd_jxdy.Size = new System.Drawing.Size(792, 240);
			this.dgd_jxdy.TabIndex = 1;
			this.dgd_jxdy.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgd_jxdy_MouseDown);
			this.dgd_jxdy.Click += new System.EventHandler(this.dgd_jxdy_Click);
			this.dgd_jxdy.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgd_jxdy_MouseUp);
			// 
			// pnl_jxdy2
			// 
			this.pnl_jxdy2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.pnl_jxdy2.Controls.Add(this.txt_zsdsm);
			this.pnl_jxdy2.Controls.Add(this.lbl_zsdsm);
			this.pnl_jxdy2.Controls.Add(this.txt_yttl);
			this.pnl_jxdy2.Controls.Add(this.txt_zttl);
			this.pnl_jxdy2.Controls.Add(this.txt_nttl);
			this.pnl_jxdy2.Controls.Add(this.txt_jxdymc);
			this.pnl_jxdy2.Controls.Add(this.lbl_yttl);
			this.pnl_jxdy2.Controls.Add(this.lbl_zttl);
			this.pnl_jxdy2.Controls.Add(this.lbl_nttl);
			this.pnl_jxdy2.Controls.Add(this.lbl_jxdymc);
			this.pnl_jxdy2.Location = new System.Drawing.Point(0, 296);
			this.pnl_jxdy2.Name = "pnl_jxdy2";
			this.pnl_jxdy2.Size = new System.Drawing.Size(792, 208);
			this.pnl_jxdy2.TabIndex = 2;
			// 
			// txt_zsdsm
			// 
			this.txt_zsdsm.Location = new System.Drawing.Point(320, 40);
			this.txt_zsdsm.Multiline = true;
			this.txt_zsdsm.Name = "txt_zsdsm";
			this.txt_zsdsm.Size = new System.Drawing.Size(464, 144);
			this.txt_zsdsm.TabIndex = 9;
			this.txt_zsdsm.Text = "";
			// 
			// lbl_zsdsm
			// 
			this.lbl_zsdsm.Location = new System.Drawing.Point(320, 16);
			this.lbl_zsdsm.Name = "lbl_zsdsm";
			this.lbl_zsdsm.Size = new System.Drawing.Size(128, 23);
			this.lbl_zsdsm.TabIndex = 8;
			this.lbl_zsdsm.Text = "教学单元知识点说明";
			// 
			// txt_yttl
			// 
			this.txt_yttl.Location = new System.Drawing.Point(112, 166);
			this.txt_yttl.Name = "txt_yttl";
			this.txt_yttl.Size = new System.Drawing.Size(168, 21);
			this.txt_yttl.TabIndex = 7;
			this.txt_yttl.Text = "";
			this.txt_yttl.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_yttl_KeyPress);
			// 
			// txt_zttl
			// 
			this.txt_zttl.Location = new System.Drawing.Point(112, 120);
			this.txt_zttl.Name = "txt_zttl";
			this.txt_zttl.Size = new System.Drawing.Size(168, 21);
			this.txt_zttl.TabIndex = 6;
			this.txt_zttl.Text = "";
			this.txt_zttl.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_zttl_KeyPress);
			// 
			// txt_nttl
			// 
			this.txt_nttl.Location = new System.Drawing.Point(112, 66);
			this.txt_nttl.Name = "txt_nttl";
			this.txt_nttl.Size = new System.Drawing.Size(168, 21);
			this.txt_nttl.TabIndex = 5;
			this.txt_nttl.Text = "";
			this.txt_nttl.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_nttl_KeyPress);
			// 
			// txt_jxdymc
			// 
			this.txt_jxdymc.Location = new System.Drawing.Point(112, 16);
			this.txt_jxdymc.Name = "txt_jxdymc";
			this.txt_jxdymc.Size = new System.Drawing.Size(168, 21);
			this.txt_jxdymc.TabIndex = 4;
			this.txt_jxdymc.Text = "";
			// 
			// lbl_yttl
			// 
			this.lbl_yttl.Location = new System.Drawing.Point(8, 166);
			this.lbl_yttl.Name = "lbl_yttl";
			this.lbl_yttl.TabIndex = 3;
			this.lbl_yttl.Text = "易题题量";
			// 
			// lbl_zttl
			// 
			this.lbl_zttl.Location = new System.Drawing.Point(8, 116);
			this.lbl_zttl.Name = "lbl_zttl";
			this.lbl_zttl.TabIndex = 2;
			this.lbl_zttl.Text = "中题题量";
			// 
			// lbl_nttl
			// 
			this.lbl_nttl.Location = new System.Drawing.Point(8, 66);
			this.lbl_nttl.Name = "lbl_nttl";
			this.lbl_nttl.TabIndex = 1;
			this.lbl_nttl.Text = "难题题量";
			// 
			// lbl_jxdymc
			// 
			this.lbl_jxdymc.Location = new System.Drawing.Point(8, 16);
			this.lbl_jxdymc.Name = "lbl_jxdymc";
			this.lbl_jxdymc.TabIndex = 0;
			this.lbl_jxdymc.Text = "教学单元名称";
			// 
			// pnl_jxdy3
			// 
			this.pnl_jxdy3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.pnl_jxdy3.Controls.Add(this.btn_qx);
			this.pnl_jxdy3.Controls.Add(this.btn_qdtj);
			this.pnl_jxdy3.Controls.Add(this.btn_sc);
			this.pnl_jxdy3.Controls.Add(this.btn_tj);
			this.pnl_jxdy3.Controls.Add(this.btn_bj);
			this.pnl_jxdy3.Controls.Add(this.btn_mjl);
			this.pnl_jxdy3.Controls.Add(this.btn_hyjr);
			this.pnl_jxdy3.Controls.Add(this.btn_qyjr);
			this.pnl_jxdy3.Controls.Add(this.btn_sjr);
			this.pnl_jxdy3.Location = new System.Drawing.Point(0, 504);
			this.pnl_jxdy3.Name = "pnl_jxdy3";
			this.pnl_jxdy3.Size = new System.Drawing.Size(792, 64);
			this.pnl_jxdy3.TabIndex = 3;
			// 
			// btn_qx
			// 
			this.btn_qx.Location = new System.Drawing.Point(704, 8);
			this.btn_qx.Name = "btn_qx";
			this.btn_qx.TabIndex = 8;
			this.btn_qx.Text = "取消";
			this.btn_qx.Click += new System.EventHandler(this.btn_qx_Click);
			// 
			// btn_qdtj
			// 
			this.btn_qdtj.Location = new System.Drawing.Point(617, 8);
			this.btn_qdtj.Name = "btn_qdtj";
			this.btn_qdtj.TabIndex = 7;
			this.btn_qdtj.Text = "确定提交";
			this.btn_qdtj.Click += new System.EventHandler(this.btn_qdtj_Click);
			// 
			// btn_sc
			// 
			this.btn_sc.Location = new System.Drawing.Point(530, 8);
			this.btn_sc.Name = "btn_sc";
			this.btn_sc.TabIndex = 6;
			this.btn_sc.Text = "删除";
			this.btn_sc.Click += new System.EventHandler(this.btn_sc_Click);
			// 
			// btn_tj
			// 
			this.btn_tj.Location = new System.Drawing.Point(443, 8);
			this.btn_tj.Name = "btn_tj";
			this.btn_tj.TabIndex = 5;
			this.btn_tj.Text = "添加";
			this.btn_tj.Click += new System.EventHandler(this.btn_tj_Click);
			// 
			// btn_bj
			// 
			this.btn_bj.Location = new System.Drawing.Point(356, 8);
			this.btn_bj.Name = "btn_bj";
			this.btn_bj.TabIndex = 4;
			this.btn_bj.Text = "编辑";
			this.btn_bj.Click += new System.EventHandler(this.btn_bj_Click);
			// 
			// btn_mjl
			// 
			this.btn_mjl.Location = new System.Drawing.Point(269, 8);
			this.btn_mjl.Name = "btn_mjl";
			this.btn_mjl.TabIndex = 3;
			this.btn_mjl.Text = "末记录";
			this.btn_mjl.Click += new System.EventHandler(this.btn_mjl_Click);
			// 
			// btn_hyjr
			// 
			this.btn_hyjr.Location = new System.Drawing.Point(182, 8);
			this.btn_hyjr.Name = "btn_hyjr";
			this.btn_hyjr.TabIndex = 2;
			this.btn_hyjr.Text = "后一记录";
			this.btn_hyjr.Click += new System.EventHandler(this.btn_hyjr_Click);
			// 
			// btn_qyjr
			// 
			this.btn_qyjr.Location = new System.Drawing.Point(95, 8);
			this.btn_qyjr.Name = "btn_qyjr";
			this.btn_qyjr.TabIndex = 1;
			this.btn_qyjr.Text = "前一记录";
			this.btn_qyjr.Click += new System.EventHandler(this.btn_qyjr_Click);
			// 
			// btn_sjr
			// 
			this.btn_sjr.Location = new System.Drawing.Point(8, 8);
			this.btn_sjr.Name = "btn_sjr";
			this.btn_sjr.TabIndex = 0;
			this.btn_sjr.Text = "首记录";
			this.btn_sjr.Click += new System.EventHandler(this.btn_sjr_Click);
			// 
			// Form_jxdy
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(792, 573);
			this.Controls.Add(this.pnl_jxdy3);
			this.Controls.Add(this.pnl_jxdy2);
			this.Controls.Add(this.dgd_jxdy);
			this.Controls.Add(this.pnl_jxdy1);
			this.Name = "Form_jxdy";
			this.Text = "教学单元内容管理";
			this.Load += new System.EventHandler(this.Form_jxdy_Load);
			this.pnl_jxdy1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dgd_jxdy)).EndInit();
			this.pnl_jxdy2.ResumeLayout(false);
			this.pnl_jxdy3.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		public SqlConnection sqlcnt = new SqlConnection();

		SqlDataAdapter sqldpt_jxdy1= new SqlDataAdapter ();
		DataSet dst_jxdy1 = new DataSet ();
		SqlDataAdapter sqldpt_jxdy2 = new SqlDataAdapter();
		DataSet dst_jxdy2 = new DataSet ();

		int intcou;//
		bool modifyok = false;//点击添加之后为true
		
		SqlCommand sqlcmd = new SqlCommand();

		private void Form_jxdy_Load(object sender, System.EventArgs e)
		{
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.ControlBox = false;

			btn_qd.Enabled = false;
			sqlcnt.ConnectionString = dbAccess.conn ;
			try
			{
				sqlcnt.Open();
							
			}
			catch
			{
				MessageBox.Show("服务器连接出错","阜和教育课程体系试题库系统提示");
				return;                
			}
			btn_sjr.Enabled = false;
			btn_qyjr.Enabled = false;

⌨️ 快捷键说明

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