public void fetchStudents()
        {
            string     qry = "Select * from Student";
            SqlCommand cmd = new SqlCommand();

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

            while (reader.Read())
            {
                RegisteredStudentData student = new RegisteredStudentData();

                student.Student_ID1     = (string)reader["Student_ID"];
                student.Name1           = (string)reader["Name"];
                student.St_Father_Name1 = (string)reader["St_Father_Name"];
                student.Class_ID1       = (string)reader["Class_ID"];
                //student.Reg_ID1 = (string)reader["Reg_ID"];

                studentsList.Add(student);
            }

            SMS.connect.Close();
        }
        public void fetchStudentInfo()
        {
            string     qry = "Select DISTINCT * 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())
            {
                RegisteredStudentData student = new RegisteredStudentData();

                student.Name1 = (string)reader["Name"];

                lblStudentName.Text = student.Name1;

                student.Class_ID1  = (string)reader["Class_ID"];
                lblEnrolledIn.Text = student.Class_ID1;

                lblStudentEmail.Text = cnic;
            }
            SMS.connect.Close();
        }
Esempio n. 3
0
        private void cbSelectedStudent_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = cbSelectedStudent.SelectedIndex;

            RegisteredStudentData student = students.ElementAt(index);
            string courseId = student.Class_ID1;

            fetchCourses_(courseId);
        }
        public void fetchStudentInfo()
        {
            string     qry = "Select DISTINCT * from Teacher_ ";
            SqlCommand cmd = new SqlCommand();

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

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                RegisteredStudentData student = new RegisteredStudentData();


                student.Name1 = (string)reader["Name"];

                student.Class_ID1 = (string)reader["Class_ID"];

                students.Add(student);
            }
            SMS.connect.Close();
        }