Example #1
0
        private void addSV_Click(object sender, EventArgs e)
        {
            string ma            = textMa.Text;
            string ho            = textHo.Text;
            string ten           = textTen.Text;
            string ngaysinh      = dateTimeNgaySinh.Text;
            string noisinh       = comboBoxNoiSinh.Text;
            string gioitinh      = comboBoxGioiTinh.Text;
            string dantoc        = comboBoxDanToc.Text;
            string malop         = comboBoxLop.Text;
            string maDT          = comboBoxDoiTuong.Text;
            string ngayvaotruong = dateTimeNgayVaoTruong.Text;
            string trangthai     = comboBoxTrangThai.Text;

            SqlConnection con = new SqlConnection();

            con.ConnectionString = KetNoi.str;
            con.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = con;
            cmd.CommandText = "INSERT INTO SinhVien(MaSV,Ho,Ten,NgaySinh,NoiSinh,GioiTinh,DanToc,MaLop,MaDT,NgayVaoTruong,TrangThai) VALUES('" + ma + "','" + ho + "','" + ten + "','" + ngaysinh + "','" + noisinh + "','" + gioitinh + "','" + dantoc + "','" + malop + "','" + maDT + "','" + ngayvaotruong + "','" + trangthai + "')";
            cmd.ExecuteNonQuery();
            DialogResult result;

            result = MessageBox.Show("THÊM DỮ LIỆU THÀNH CÔNG", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            if (result == DialogResult.OK)
            {
                this.Close();
                fManager frm = new fManager();
                frm.Show();
            }
        }
Example #2
0
        private void Login_Click(object sender, EventArgs e)
        {
            fManager f = new fManager();

            this.Hide();
            f.ShowDialog();
            this.Show();
        }
Example #3
0
        void binDingUpdate()
        {
            fManager mana = new fManager();

            textMa.Text = mana.textMa.Text;  //textMa bên fManager để chế độ public

            //textMa.DataBindings.Add(new Binding("Text", dataList.DataSource, "MaSV"));
            //textHo.DataBindings.Add(new Binding("Text", dataList.DataSource, "Ho"));
            //textTen.DataBindings.Add(new Binding("Text", dataList.DataSource, "Ten"));
            //dateTimeNgaySinh.DataBindings.Add(new Binding("Value", dataList.DataSource, "NgaySinh"));
            //comboBoxNoiSinh.DataBindings.Add(new Binding("Text", dataList.DataSource, "NoiSinh"));
            //comboBoxGioiTinh.DataBindings.Add(new Binding("Text", dataList.DataSource, "GioiTinh"));
            //comboBoxDanToc.DataBindings.Add(new Binding("Text", dataList.DataSource, "DanToc"));
            //comboBoxMaLop.DataBindings.Add(new Binding("Text", dataList.DataSource, "MaLop"));
            //comboBoxMaDT.DataBindings.Add(new Binding("Text", dataList.DataSource, "MaDT"));
            //dateTimeNgayVaoTruong.DataBindings.Add(new Binding("Value", dataList.DataSource, "NgayVaoTruong"));
            //comboBoxTrangThai.DataBindings.Add(new Binding("Text", dataList.DataSource, "TrangThai"));
        }