private void button_insert_termsForCourse_Click(object sender, EventArgs e) { this.Hide(); A_InsertConditionTermsForCourse InsertCo = new A_InsertConditionTermsForCourse(); InsertCo.ShowDialog(); }
private void A_InsertConditionTermsForCourse_Load(object sender, EventArgs e) { currentA_InsertConditionTermsForCourse = this; comboBox1_CourseName.Items.Clear(); comboBox2PreCondition.Items.Clear(); cn.Open(); SqlCommand cmd = cn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select Name from Courses"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); foreach (DataRow dr in dt.Rows) { comboBox1_CourseName.Items.Add(dr["Name"].ToString()); comboBox2PreCondition.Items.Add(dr["Name"].ToString()); } cn.Close(); }