TestOnline/test2.aspx.cs
(开头部分) 3KB这里只显示每个文件的开头 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 TextBox[] TextBox1 = new TextBox[5];
private string testContent = "";
private int score = 0;
private static string[] rightAns = new string[5];
int[] testIDs = new int[5];
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 TK_test", con);
int maxTestID = (int)cmd.ExecuteScalar();
Random rand = new Random();
for (int i = 0; i < 5; i++)
{
int j = rand.Next(1, maxTestID);
int k = 0;
cmd = new SqlCommand("select id from TK_test where id=" + j, con);
while (cmd.ExecuteScalar() == null)
{
j = rand.Next(1, maxTestID);
cmd = new SqlCommand("select id from TK_test where id=" + j, con);
}
while (k <= i)
{
cmd = new SqlCommand("select id from TK_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();
cmd = new SqlCommand("select testContent from TK_test where id=" + j, con);
testContent = (String)cmd.ExecuteScalar();
TextBox1[i] = new TextBox();
l.Text = i + 1 + ". " + testContent + "<br>";
后面还有 43 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
