private void LoadDgv(String studentCode)
        {
            MyConnection.OpenDB();
            String sql = "SELECT  tblMark.courseCode ,\n"
                         + "        tblCourse.name ,\n"
                         + "        tblMark.avgMark\n"
                         + "FROM    ( SELECT    courseCode ,\n"
                         + "                    AVG(tblMarkReport.mark) AS avgMark\n"
                         + "          FROM      dbo.tblMarkReport\n"
                         + "          WHERE     studentCode = '" + studentCode + "'\n"
                         + "          GROUP BY  tblMarkReport.courseCode\n"
                         + "        ) AS tblMark\n"
                         + "        JOIN dbo.tblCourse ON dbo.tblCourse.code = tblMark.courseCode;";

            dgvMark.DataSource = MyConnection.GetDataTable(sql);
        }
        public void loadAvgMark(String studentCode)
        {
            MyConnection.OpenDB();
            String sql = "SELECT	tblMark.avgMark FROM(SELECT    AVG(tblMarkReport.mark) AS avgMark FROM dbo.tblMarkReport WHERE studentCode = '"+ studentCode + "') AS tblMark";

            cmd = new SqlCommand(sql, conn);

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                float sAvgMark = reader.GetFloat(2);

                float.Parse(txtAvgMark.Text) = sAvgMark;
            }
        }
        public void loadStudentInfo(String studentCode)
        {
            MyConnection.OpenDB();
            //String sql = "SELECT  tblMark.courseCode ,\n"
            //+ "        tblCourse.name ,\n"
            //+ "        tblMark.avgMark ,\n"
            //+ "        tblStudent.firstName ,\n "
            //+ "        tblStudent.lastName ,\n "
            //+ "        tblStudent.DateOfBirth ,\n "
            //+ "        tblStudent.sex ,\n "
            //+ "        tblStudent.classCode ,\n "
            //+ "FROM    ( SELECT    courseCode ,\n"
            //+ "                    AVG(tblMarkReport.mark) AS avgMark\n"
            //+ "          FROM      dbo.tblMarkReport\n"
            //+ "          WHERE     studentCode = '" + studentCode + "'\n"
            //+ "          GROUP BY  tblMarkReport.courseCode\n"
            //+ "        ) AS tblMark\n"
            //+ "        JOIN dbo.tblCourse ON dbo.tblCourse.code = tblMark.courseCode;";
            String sql = "SELECT * FROM  tblStudent";

            cmd = new SqlCommand(sql, conn);

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                String  sLastName   = reader.GetString(2);
                String  sFirstName  = reader.GetString(1);
                String  sDayOfBirth = reader.GetDateTime(3).ToString("dd/MM/yyyy");
                Boolean sSex        = reader.GetBoolean(4);
                String  sClassCode  = reader.GetString(5);


                txtFirstName.Text   = sFirstName;
                txtLastName.Text    = sLastName;
                txtDateOfBirth.Text = sDayOfBirth;
                if (sSex == true)
                {
                    txtSex.Text = "Nu";
                }
                else
                {
                    txtSex.Text = "Nam";
                }
                txtClassCode.Text = sClassCode;
            }
        }