frmTeacher.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;

namespace CS2013
{
    public partial class frmTeacher : Form
    {
        public frmTeacher()
        {
            InitializeComponent();
        }

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

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text == "" || this.textBox2.Text == "")
            {
                MessageBox.Show("有未填写内容,请检查!");
            }
            else 
            {
                string sex = this.radioButton1.Checked ? "" : "";
                string sql = string.Format("insert into TEACHERS values('{0}','{1}','{2}')",
                    this.textBox1.Text, this.textBox2.Text, sex);
                SqlManage.TableChange(sql);
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            string sex = this.radioButton1.Checked ? "" : "";
            string sql = string.Format("update TEACHERS set TNAME = '{1}',TSEX = '{2}' where TNO = '{0}'",
                this.textBox1.Text, this.textBox2.Text, sex);
            SqlManage.TableChange(sql);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            string sql = string.Format("delete from TEACHERS where TNO = '{0}'",
                this.textBox1.Text);
            SqlManage.TableChange(sql);
        }
    }
}

 

posted on 2017-03-16 16:01  Cody_Rainfall  阅读(94)  评论(0)    收藏  举报

导航