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

📄 getscore.aspx.cs

📁 用ASP.NET(C#)、SQL Server2000数据库开发在线考试系统源代码
💻 CS
字号:
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 ExamineSystem
{
	/// <summary>
	/// GetScore 的摘要说明。
	/// </summary>
	public class GetScore : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.HtmlControls.HtmlGenericControl title;
		protected System.Web.UI.HtmlControls.HtmlForm Register;
		public int nAnswerID = 0;
		public int Mark = 0;
		private void Page_Load(object sender, System.EventArgs e)
		{
			///验证用户的权限
			if(Session["UserID"] == null)
			{
				Response.Redirect("~/Default.aspx");
			}
			
			if(!Page.IsPostBack)
			{
				for(int i = 0;i < 10;i++){
					nAnswerID = Int32.Parse(Request.Params["QuestionList:_ctl+i+:AnswerList"].ToString());
					GetRorW(nAnswerID);
						   }
				
			}
		}

		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
	
		
		private void GetRorW(int nAnswerID)
		{
			
			SqlConnection myConnection = new SqlConnection(SQLHelper.DBCONNECTIONSTRING);
			String cmdTxt = "Select * from Answers Where AnswerID ='"+ nAnswerID.ToString() +"'";
			SqlCommand myCommand = new SqlCommand(cmdTxt,myConnection);
			myConnection.Open();
			SqlDataReader recrorw = myCommand.ExecuteReader();
			
			while(recrorw.Read())
			{
				if(recrorw["RorW"].ToString() == "1"){Mark=Mark+10;}
					
			}
			recrorw.Close();
			myCommand.CommandText = "INSERT INTO Examinees (UserID,TakepartDate,Mark)VALUES('"+Session["UserID"].ToString()+"',GetDate(),'"+Mark.ToString()+"')";
			myCommand.ExecuteNonQuery();
			myConnection.Close();
			Response.Redirect("~/Score.aspx");

		}
		
	}
}

⌨️ 快捷键说明

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