exam.aspx.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace 在线考试
{
public partial class exam : System.Web.UI.Page
{
SQLHelper db = new SQLHelper();
int cj = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
this.Button2.Enabled = false;
DateTime dt = DateTime.Now;
}
}
//
public void bind()
{
int kc_id = int.Parse(Request.QueryString["kc_id"].ToString());
string sql = "select top 10 * from ti where xz='选择题' and kc_id="+kc_id+" order by newid()";
DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
this.gv.DataSource = dt;
this.gv.DataBind();
//
string q = "select top 10 * from ti where xz='判断题' and kc_id=" + kc_id + " order by newid()";
DataTable dt2 = db.ExecuteQuery(q, CommandType.Text);
this.gv_judge.DataSource = dt2;
this.gv_judge.DataBind();
//
}
protected void Button1_Click(object sender, EventArgs e)
{
//
foreach (GridViewRow dr in gv.Rows)//对单选题每题进行判断用户选择答案
{
string str = "";
if (((RadioButton)dr.FindControl("rbt_ansa")).Checked)
{
str = "A";
}
if (((RadioButton)dr.FindControl("rbt_ansb")).Checked)
{
str = "B";
}
if (((RadioButton)dr.FindControl("rbt_ansc")).Checked)
{
str = "C";
}
if (((RadioButton)dr.FindControl("rbt_ansd")).Checked)
{
str = "D";
后面还有 58 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。