protected void Button2_Click(object sender, EventArgs e) { Groupp groupp = new Groupp(); bool test = groupp.test_groupp_name(TextBox8.Text, Convert.ToInt32(DropDownList2.SelectedValue)); if (test == false) { Label15.Text = "Введите другое имя класса"; } else { Label15.Text = "OK"; groupp.add(TextBox8.Text, Convert.ToInt32(DropDownList3.SelectedValue), Convert.ToInt32(DropDownList2.SelectedValue)); } }
public new void delete(int user_id) { delete_teacher.connection.Open(); Groupp update_groupp_Tid = new Groupp(); SqlCommand sqlCom = new SqlCommand("SELECT * FROM dbo.teacher WHERE user_id LIKE '%" + user_id + "'", delete_teacher.connection); SqlDataReader dr = sqlCom.ExecuteReader(); dr.Read(); update_groupp_Tid.update_Tid(Convert.ToInt32(dr["teacher_id"])); delete_teacher.connection.Close(); //========== delete_teacher.connection.Open(); string sql = string.Format("Delete from teacher where user_id = '{0}'", user_id); using (SqlCommand cmd = new SqlCommand(sql, delete_teacher.connection)) { cmd.ExecuteNonQuery(); } delete_teacher.connection.Close(); }