⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.cs

📁 简单的通讯录程序
💻 CS
字号:
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.Threading;

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

        private void button2_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void button1_Click(object sender, EventArgs e)
        {   
            String name = textBox1.Text;
            String password = textBox2.Text;
            String psw = textBox3.Text;
            
            ClsDB.ClsDBControl Con = new OptDB.ClsDB.ClsDBControl();

            if (name == "")
            {
                MessageBox.Show("姓名不能为空!!!");
                return;
            }
            
            if (password == "")
            {
                MessageBox.Show("密码不能为空!!!");
                return;
            }

            if (!psw.Equals(password))
            {
                MessageBox.Show("两次密码输入不相同!!!");
                return;
            }
            
            string strSql = "insert into user1 values('" + textBox1.Text + "','" + textBox2.Text + "')";
            
            
            if (Con.insertDB(strSql))
            {
                MessageBox.Show("添加成功!!!");
                this.Dispose();
            }
        
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -