Beispiel #1
0
        private void cbCourses_SelectedIndexChanged(object sender, EventArgs e)
        {
            string id = cbCourses.SelectedItem.ToString();

            txtCourseName.Text = (courseTable.FindByCourseID(id)).CourseName;
            this.txtCost.Text  = (courseTable.FindByCourseID(id)).Cost.ToString("C");
        }
        private void cbCourses_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbStudents.Items.Clear();
            string id = cbCourses.SelectedItem.ToString();

            this.txtName.Text = (table.FindByCourseID(id)).CourseName;
            this.txtCost.Text = (table.FindByCourseID(id)).Cost.ToString("C");

            Tafe_DataTier dt = new Tafe_DataTier();

            System.Data.SqlClient.SqlDataReader dr = dt.getStudentsEnrolledInCourse(id);
            if (!dr.HasRows)
            {
                lbStudents.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                while (dr.Read())
                {
                    this.lbStudents.Items.Add(dr.GetString(0) + "-->" + dr.GetString(1));
                }
            }
        }