Exemple #1
0
        public void fetchCourses(string courseId)
        {
            string     qry = "Select * from Course where Course_ID ='" + courseId + "'";
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = SMS.connect;
            cmd.CommandText = qry;
            if (SMS.connect != null && SMS.connect.State == ConnectionState.Closed)
            {
                SMS.connect.Open();
            }

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                CourseData course = new CourseData();
                course.Course_ID1 = (string)reader["Course_ID"];
                course.Name1      = (string)reader["Name"];
                // course.Class_ID1 = (string)reader["Class_ID"];
                courses.Add(course);
            }

            SMS.connect.Close();
        }
 public void loadCourses()
 {
     for (int i = 0; i < courses.Count; i++)
     {
         CourseData item = courses.ElementAt(i);
         cbCourses.Items.Add(item.Course_ID1 + " " + item.Name1);
     }
 }
        public void fetchCourses()
        {
            string     qry = "Select * from Course where Course_ID IN(Select Course_ID from CourseClass where Class_ID =  (SELECT Distinct Class_ID FROM Student where Student_ID = '" + cnic + "'))";
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = SMS.connect;
            cmd.CommandText = qry;
            SMS.connect.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                CourseData course = new CourseData();
                course.Course_ID1 = (string)reader["Course_ID"];
                course.Name1      = (string)reader["Name"];
                // course.Class_ID1 = (string)reader["Class_ID"];
                courses.Add(course);
            }

            SMS.connect.Close();
        }
        public void fetchCourses()
        {
            string     qry = "Select * from Course";
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = SMS.connect;
            cmd.CommandText = qry;
            SMS.connect.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                CourseData course = new CourseData();
                course.Course_ID1 = (string)reader["Course_ID"];
                course.Name1      = (string)reader["Name"];
                // course.Class_ID1 = (string)reader["Class_ID"];
                courses.Add(course);
            }

            SMS.connect.Close();
        }