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

📄 xuesheng.cs

📁 我做的题库管理系统。大家看看吧
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.label12.Text = "C";
			this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// txttihao
			// 
			this.txttihao.Location = new System.Drawing.Point(8, 40);
			this.txttihao.Name = "txttihao";
			this.txttihao.ReadOnly = true;
			this.txttihao.Size = new System.Drawing.Size(56, 21);
			this.txttihao.TabIndex = 68;
			this.txttihao.Text = "1";
			// 
			// txttimu
			// 
			this.txttimu.Location = new System.Drawing.Point(8, 67);
			this.txttimu.Multiline = true;
			this.txttimu.Name = "txttimu";
			this.txttimu.ReadOnly = true;
			this.txttimu.Size = new System.Drawing.Size(500, 80);
			this.txttimu.TabIndex = 56;
			this.txttimu.Text = "";
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("楷体_GB2312", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(16, 11);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(492, 40);
			this.label1.TabIndex = 67;
			this.label1.Text = "安徽机电职业技术学院计算机一级模拟试题";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// butexit
			// 
			this.butexit.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.butexit.Location = new System.Drawing.Point(320, 320);
			this.butexit.Name = "butexit";
			this.butexit.Size = new System.Drawing.Size(72, 25);
			this.butexit.TabIndex = 72;
			this.butexit.Text = "提交试卷";
			this.butexit.Click += new System.EventHandler(this.butexit_Click);
			// 
			// buttimu
			// 
			this.buttimu.Location = new System.Drawing.Point(16, 320);
			this.buttimu.Name = "buttimu";
			this.buttimu.TabIndex = 73;
			this.buttimu.Text = "开始考试";
			this.buttimu.Click += new System.EventHandler(this.buttimu_Click);
			// 
			// xuesheng
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(520, 358);
			this.Controls.Add(this.buttimu);
			this.Controls.Add(this.butexit);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.butnext);
			this.Controls.Add(this.butup);
			this.Controls.Add(this.txtD);
			this.Controls.Add(this.txtB);
			this.Controls.Add(this.txtA);
			this.Controls.Add(this.txtC);
			this.Controls.Add(this.txtda);
			this.Controls.Add(this.label6);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.txttihao);
			this.Controls.Add(this.txttimu);
			this.Controls.Add(this.label1);
			this.Name = "xuesheng";
			this.Text = "xuesheng";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		
		private void loandata(int tihao)
		{
			
			this.conn=new OleDbConnection();
			conn.ConnectionString=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=score.mdb ";
			string sqlstring="Select *  From 题目表 where 题号="+tihao+"";
			this.comm=new OleDbCommand(sqlstring,conn);
			conn.Open();
			OleDbDataReader dr=comm.ExecuteReader();
			dr.Read();
			txttimu.Text="";
			txtA.Text="";
			txtB.Text="";
			txtC.Text="";
			txtD.Text="";
			txttimu.AppendText(dr["题目"].ToString());
			txtA.AppendText(dr["A"].ToString());
			txtB.AppendText(dr["B"].ToString());
			txtC.AppendText(dr["C"].ToString());
			txtD.AppendText(dr["D"].ToString());
			conn.Close();
		}
		
		private void buttimu_Click(object sender, System.EventArgs e)
		{
		    int tihao=Int32.Parse(txttihao.Text);
			this.conn=new OleDbConnection();
			conn.ConnectionString=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=score.mdb ";
			string sqlstring="Select *  From 题目表 where 题号="+tihao+"";
			this.comm=new OleDbCommand(sqlstring,conn);
			conn.Open();
			OleDbDataReader dr=comm.ExecuteReader();
			dr.Read();
			txttimu.Text="";
			txtA.Text="";
			txtB.Text="";
			txtC.Text="";
			txtD.Text="";
			txttimu.AppendText(dr["题目"].ToString());
			txtA.AppendText(dr["A"].ToString());
			txtB.AppendText(dr["B"].ToString());
			txtC.AppendText(dr["C"].ToString());
			txtD.AppendText(dr["D"].ToString());
			conn.Close();
		}

		private void butnext_Click(object sender, System.EventArgs e)
		{
		       int tihao=Int32.Parse(txttihao.Text);
				if(tihao!=20)
				{
					
						tihao++;
				        loandata(tihao);
						txttihao.Text=tihao.ToString();
					
					
				}
			txtda.Text="";
//		updata();
		
		}

		private void butup_Click(object sender, System.EventArgs e)
		{
			int tihao=Int32.Parse(txttihao.Text);
		
			if(tihao!=1)
			{
				tihao=tihao-1;
				loandata(tihao);
				txttihao.Text=tihao.ToString();
			}
			else
			{
				MessageBox.Show("这已是第一题!");
			}
			txtda.Text="";
//			updata();

//			txtda_TextChanged();
			
		}

		private void butexit_Click(object sender, System.EventArgs e)
		{
			
			DialogResult  result=MessageBox.Show("你真的要交试卷吗?","提交试卷",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
			if(result==DialogResult.Yes)
			{
//				this.Close();
				DialogResult re=MessageBox.Show("恭喜你!这次考试的得分是:"+chengji.ToString(),"考试结果",MessageBoxButtons.YesNo);
				if(re==DialogResult.Yes)
				{
					this.Close();
				}
				
			}
			
		}

		
//		private void updata()
//		{
//		
//
//	
//		
//		}
//		private void updata()
//		{
//			int tihao=Int32.Parse(txttihao.Text);
//			
//			string da=txtda.Text;
//			string sqlstring =@"update [题目表] set 学生答案='"+da+"' where 题号="+tihao+"";
//			this.conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=score.mdb ");
//			this.comm=new OleDbCommand(sqlstring,conn);
//			conn.Open();
//			try
//			{
//				comm.ExecuteNonQuery();
////				MessageBox.Show("恭喜你,题目更新成功!");
//
//
//			}
//			catch(Exception ex)
//			{
////				MessageBox.Show("更新时,出错的原因:\n"+ex.Message+"\n");
//			}
//
//			conn.Close();
//		}

		
		private void txtda_TextChanged(object sender, System.EventArgs e)
		{
		
			string xueshengda=txtda.Text;
			int tihao=Int32.Parse(txttihao.Text);
			string sqlstring =@"update [题目表] set 学生答案='"+xueshengda+"' where 题号="+tihao+"";
			this.conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=score.mdb ");
		    sqlstring="Select *  From 题目表 where 题号="+tihao+"";
			this.comm=new OleDbCommand(sqlstring,conn);
			conn.Open();
			OleDbDataReader dr=comm.ExecuteReader();
			dr.Read();
			if(dr["学生答案"]==null)
			{
				if(xueshengda==dr["答案"].ToString())
				{
			   
					chengji=chengji+5;
				}
			
			 }
			else
			{
				if(dr["学生答案"].ToString()!=dr["答案"].ToString()&&xueshengda==dr["答案"].ToString())
				{
					chengji=chengji+5;
				}
				else
				{
					chengji=chengji;
				}
			}
		    


		   
			
//			MessageBox.Show(chengji.ToString());

//			txtda.Text="";
			conn.Close();
		}

		
		
	}
}

⌨️ 快捷键说明

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