server/testMonitor.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace server
{
    public partial class testMonitor : Form
    {
        SqlConnection conn = null;
        public testMonitor()
        {
            InitializeComponent();
        }

        private void testMonitor_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;//测试的话计时器 interval 可以改短点
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (conn != null)
            {
                conn.Close();
            }
            timer1.Enabled = false;
            this.Close();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            string s = "server=.;uid=sa;pwd=51Aspx;database=StudentDB";
            conn = new SqlConnection(s);
            conn.Open();
            string sql = "select * from StudentDB";
            SqlDataAdapter da = new SqlDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            da.Fill(ds);
            string str = null;
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string str1 = ds.Tables[0].Rows[i]["admissionTicket"].ToString().Trim();
                string str2 = ds.Tables[0].Rows[i]["studentNumber"].ToString().Trim();
                string str3 = ds.Tables[0].Rows[i]["studentName"].ToString().Trim();
                str3 = str3 + new string(' ', 10 - Encoding.GetEncoding("gb2312").GetBytes(str3).Length);
                string str4 = ds.Tables[0].Rows[i]["classAndGrade"].ToString().Trim();
                string str5 = ds.Tables[0].Rows[i]["ip"].ToString().Trim();
                string str6 = ds.Tables[0].Rows[i]["TestCondition"].ToString().Trim();
                str = string.Format("{0,-20}{1,-18}{2,-15}{3,-17}{4,-30}{5,-6}", str1, str2, str3, str4, str5, str6);//{,距离}
                listBox1.Items.Add(str);
            }
后面还有 3 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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