zhuce.cs

来自「火车票的销售系统」· CS 代码 · 共 50 行

CS
50
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace pwxt
{
    public partial class zhuce : Form
    {
        public zhuce()
        {
            InitializeComponent();
        }
    
       static int k=0;
       

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

        

        private void button1_Click(object sender, EventArgs e)
        {
           
            k++;
            string selectstr = "Insert into USertable(xuhao,name,pasd) values ('" + k.ToString() + "','" + this.textBox1.Text + "','" + this.textBox2.Text + "')";
            SqlConnection sconn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["connectionstring"]);
            SqlCommand scmd = new SqlCommand(selectstr, sconn);
            sconn.Open();
            int EXENum = scmd.ExecuteNonQuery();
            if (EXENum == 1)
                MessageBox.Show("注册成功");
            else
                MessageBox.Show("注册失败");

            sconn.Close();
          
             
        }
     
        
    }
}

⌨️ 快捷键说明

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