TestOnline/test.aspx.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
  
    private RadioButton[] testBtn1 = new RadioButton[10];
    private RadioButton[] testBtn2 = new RadioButton[10];
    private RadioButton[] testBtn3 = new RadioButton[10];
    private RadioButton[] testBtn4 = new RadioButton[10];
    private static int[] rightAns = new int[10];
    private int score = 0;
   
    public void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("server=.\\SQL2005;database=TestOnline;user id=sa;pwd=sasasa;");
        con.Open();
        SqlCommand cmd = new SqlCommand("select max(id) from XZ_test", con);
        int maxTestID = (int)cmd.ExecuteScalar();
        int[] testIDs = new int[10];
        Random rand = new Random();
        String testContent = "";
        String ans1 = "";
        String ans2 = "";
        String ans3 = "";
        String ans4 = "";
        String testID = "";
        for (int i = 0; i < 10; i++)
        {
            int j = rand.Next(1, maxTestID);
            int k = 0;
            cmd = new SqlCommand("select id from XZ_test where id=" + j, con);
            while (cmd.ExecuteScalar() == null)
            {
                j = rand.Next(1, maxTestID);
                cmd = new SqlCommand("select id from XZ_test where id=" + j, con);
            }
            while (k <= i)
            {
                cmd = new SqlCommand("select id from XZ_test where id=" + j, con);
                if (j == testIDs[k] || cmd.ExecuteScalar()==null)
                {
                    j = rand.Next(1,maxTestID);
                    k = 0;
                }
                else
                {
                    k++;
                }
            }
            Literal l = new Literal();
            Literal l1 = new Literal();
后面还有 98 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。