Beispiel #1
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            try
            {
                BLL_SV bll_sv = new BLL_SV();

                SinhVien sv = new SinhVien()
                {
                    MSSV    = txt_MSSV.Text,
                    Name    = txt_SV.Text,
                    ID_Khoa = txt_ID_Khoa.Text,
                };

                bll_sv.Add(sv);

                dataGridView1.DataSource = bll_sv.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void btn_dtgrv_sql_Click(object sender, EventArgs e)
        {
            try
            {
                BLL_SV bll_sv = new BLL_SV();

                for (int i = 0; i < dataGridView1.RowCount - 1; i++)
                {
                    SinhVien sv = new SinhVien()
                    {
                        MSSV    = dataGridView1.Rows[i].Cells[0].Value.ToString(),
                        Name    = dataGridView1.Rows[i].Cells[1].Value.ToString(),
                        ID_Khoa = dataGridView1.Rows[i].Cells[2].Value.ToString(),
                    };

                    bll_sv.Add(sv);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }