Beispiel #1
0
        private void новыйСтудентToolStripMenuItem_Click(object sender, EventArgs e)
        {
            New_Student newStudent = new New_Student();

            newStudent.ShowDialog();
            if (newStudent.DialogResult == DialogResult.OK)
            {
                string sql = $"INSERT INTO Students (Имя, Фамилия, Отчества, Оценка, Курс, Факультет, Направление, Рост,Дата_рождения, Телефон)" +
                             $" VALUES('{newStudent.Imya}', '{newStudent.Famil}','{newStudent.Otches}'," +
                             $"'{newStudent.Otsenka.ToString()}', '{newStudent.Kurs.ToString()}','{newStudent.Fakul}'," +
                             $"'{newStudent.Naprav}','{newStudent.Rost.ToString()}','{newStudent.DataRoj}', '{newStudent.Tel}')";
                datatable          = DB.db.Query(sql);
                datatable          = DB.db.Query("select * from Students");
                dgvMain.DataSource = datatable;
            }
        }
Beispiel #2
0
        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            New_Student newStudent = new New_Student(dgvMain.CurrentRow);

            newStudent.ShowDialog();
            if (newStudent.DialogResult == DialogResult.OK)
            {
                string sql = $"UPDATE Students SET Имя='{newStudent.Imya}', Фамилия='{newStudent.Famil}'," +
                             $" Отчества='{newStudent.Otches}', Оценка='{newStudent.Otsenka.ToString()}', " +
                             $" Курс='{newStudent.Kurs.ToString()}', Факультет='{newStudent.Fakul}'," +
                             $" Направление='{newStudent.Naprav}', Рост='{newStudent.Rost.ToString()}'," +
                             $" Дата_рождения='{newStudent.DataRoj}',Телефон='{newStudent.Tel}'" +
                             $" WHERE Код={dgvMain.CurrentRow.Cells[0].Value.ToString()}";
                datatable          = DB.db.Query(sql);
                datatable          = DB.db.Query("select * from Students");
                dgvMain.DataSource = datatable;
            }
        }