private void ShowAllStudentInfo()
        {
            StudentManager studentManager = new StudentManager();

            StudentGrirdView.DataSource = studentManager.GetALLStudents();
            StudentGrirdView.DataBind();
        }
Example #2
0
        private void ShowAllStudentInfo()
        {
            List <Student> studentList      = new List <Student>();
            string         connectionString = WebConfigurationManager.ConnectionStrings["IMDB"].ConnectionString;
            SqlConnection  connection       = new SqlConnection(connectionString);
            string         query            = "SELECT * FROM Student_tbl";;
            SqlCommand     command          = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                int     studentId   = (int)reader["StudentId"];
                string  studentName = reader["StudentName"].ToString();
                string  regNo       = reader["RegNo"].ToString();
                string  email       = reader["Email"].ToString();
                string  mobileNo    = reader["MobileNo"].ToString();
                int     age         = (int)reader["Age"];
                string  address     = reader["Address"].ToString();
                Student student     = new Student(studentName, regNo, email, mobileNo, age, address);
                student.StudentId = studentId;
                studentList.Add(student);
            }
            reader.Close();
            connection.Close();
            StudentGrirdView.DataSource = studentList;
            StudentGrirdView.DataBind();
        }
Example #3
0
        private void ShowAllStudentInfo()
        {
            List <Student> studentList      = new List <Student>();
            string         connectionString =
                @"Server = BITM-TRAINER-30\SQLEXPRESS;Database = InformationManagementDB;Integrated Security=true;";
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "SELECT * FROM Student_tbl";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                int     studentId   = (int)reader["StudentId"];
                string  studentName = reader["StudentName"].ToString();
                string  regNo       = reader["RegNo"].ToString();
                string  email       = reader["Email"].ToString();
                string  mobileNo    = reader["MobileNo"].ToString();
                int     age         = (int)reader["Age"];
                string  address     = reader["Address"].ToString();
                Student student     = new Student(studentName, regNo, email, mobileNo, age, address);
                student.StudentId = studentId;
                studentList.Add(student);
            }
            reader.Close();
            connection.Close();
            StudentGrirdView.DataSource = studentList;
            StudentGrirdView.DataBind();
        }
Example #4
0
 private void ShowAllStudentInfo()
 {
     StudentGrirdView.DataSource = aManager.GetAllStudent();;
     StudentGrirdView.DataBind();
 }