SqlConnection con = DB.CreateConn();
con.Open();
try
{
string sqlstr0 = "delete from Teacher_course where Teacher_course.Teacher_id='" + Gv_teach.DataKeys[e.RowIndex].Value.ToString() + "'";
string sqlstr1 = "delete from Teacher where Teacher_id='"+Gv_teach.DataKeys[e.RowIndex].Value.ToString()+"'";
SqlCommand sqlcom0 = new SqlCommand(sqlstr0, con);
sqlcom0.ExecuteNonQuery();
SqlCommand sqlcom1 = new SqlCommand(sqlstr1, con);
sqlcom1.ExecuteNonQuery();
sqlcom1.ExecuteNonQuery();
Lbl_note.Text = "删除成功";
Lbl_note.Style["color"]="green";
}
catch (SqlException)
{
Lbl_note.Text = "删除失败";
Lbl_note.Style["color"] = "red";
}
con.Close();
St_BindGridView();