train.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 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 train : System.Web.UI.Page
{
SQLHelper db = new SQLHelper();
int cj = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
//
public void bind()
{
int kc_id = int.Parse(Request.QueryString["kc_id"].ToString());
string sql = "select top 5 * 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();
}
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";
}
//
if (((Label)dr.FindControl("lb_ans")).Text.Trim() == str)//将用户选择结果和答案进行比较
{
dr.FindControl("lb_str").Visible = true;
((Label)dr.FindControl("lb_str")).Text = "您的答案是正确的";
}
后面还有 19 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。