Form2.cs

(开头部分) 1KB

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

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

namespace WindowsFormsApplication1
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form1 fm1 = new Form1();
            fm1.Show();
            this.Hide();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            var uid = textBox1.Text;
            var pwd = textBox2.Text;
            var repwd = textBox3.Text;

            if (pwd == repwd)
            {
                string constr = @"Data Source=.;Initial Catalog=yzr59;Integrated Security=True";
                SqlConnection connection = new SqlConnection(constr);
                string comstring = string.Format("insert into Student(username,password) values('{0}','{1}')", uid, pwd);
                connection.Open();
                SqlCommand com = new SqlCommand(comstring, connection);

                if (com.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("注册成功!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                    Form1 fm1 = new Form1();
                    fm1.Show();
                    this.Close();
                }
                else 
                {
                    MessageBox.Show("注册失败!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                }
                connection.Close();

            }
后面还有 9 行代码,解锁后查看完整代码

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

AI 解读

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

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