Exemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string user = this.textBox_user.Text;                 //用户名
            string pwd  = this.textBox2.Text;                     //密码

            string studentNO   = this.textBox_StudentNO.Text;     //学号
            string studentName = this.textBox_StudentName.Text;   //姓名
                                                                  //int classNum = int.Parse (textBox_class.Text) ;//班级编号
            string sex          = this.textBox_sex.Text;          //性别
            string studentIDNO  = this.textBox_StudentIDNO.Text;  //身份证号
            string major        = this.textBox_Major.Text;        //专业
            string schoolBefore = this.textBox_SchoolBefore.Text; //学校地址
            string phone        = this.textBox_phone.Text;        //电话
            string address      = this.textBox_addresss.Text;     //住址
            string postalCode   = this.textBox_PostalCode.Text;   //邮政编码
            string cityWanted   = this.textBox_JobWanted.Text;    //市区
            string jobWanted    = this.textBox_JobWanted.Text;    //职位
            string comment      = this.textBox_Comment.Text;      //备注
            string email        = this.textBox_Email.Text;        //邮箱



            SqlConnection sqlcon = new SqlConnection("Data Source=localhost;Initial Catalog=MySchool;Integrated Security=True");

            sqlcon.Open();
            string     str    = "insert into  Student(LoginId,LoginPwd,UserStateId,ClassId,StudentNO,StudentName,Sex,StudentIDNO,Major,SchoolBefore,Phone,Address,PostalCode,CityWanted,JobWanted,Comment,Email ) values ('" + user + "','" + pwd + "'," + t + "," + textBox_class.Text + ",'" + studentNO + "','" + studentName + "','" + sex + "','" + studentIDNO + "','" + major + "','" + schoolBefore + "','" + phone + "','" + address + "','" + postalCode + "','" + cityWanted + "','" + jobWanted + "','" + comment + "','" + email + "')";
            SqlCommand sqlcom = new SqlCommand(str, sqlcon);
            int        s      = sqlcom.ExecuteNonQuery();

            if (s > 0)
            {
                MessageBox.Show("添加成功");

                textBox_user.Clear();         //用户名
                textBox2.Clear();             //密码

                textBox_StudentNO.Clear();    //学号
                textBox_StudentName.Clear();  //姓名
                textBox_class.Clear();        //班级编号
                textBox_sex.Clear();          //性别
                textBox_StudentIDNO.Clear();  //身份证号
                textBox_Major.Clear();        //专业
                textBox_SchoolBefore.Clear(); //学校地址
                textBox_phone.Clear();        //电话
                textBox_addresss.Clear();     //住址
                textBox_PostalCode.Clear();   //邮政编码
                textBox_JobWanted.Clear();    //市区
                textBox_JobWanted.Clear();    //职位
                textBox_Comment.Clear();      //备注
                textBox_Email.Clear();        //邮箱

                findStudentForm studentForm = new findStudentForm();
                studentForm.Show();
                this.Close();
            }
            sqlcon.Close();
        }
Exemplo n.º 2
0
        private void 查找ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            findStudentForm findStudent = new findStudentForm();

            findStudent.Show();
        }