예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string query = "select * from classes";
            var    db    = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                classes_result.InnerHtml += "<div class=\"listitem\">";

                string classcode = row["CLASSCODE"];
                classes_result.InnerHtml += "<div class=\"col5\">" + classcode + "</div>";

                string classstartdate = row["STARTDATE"];
                classes_result.InnerHtml += "<div class=\"col5\">" + classstartdate + "</div>";

                string classfinishdate = row["FINISHDATE"];
                classes_result.InnerHtml += "<div class=\"col5\">" + classfinishdate + "</div>";

                string classname = row["CLASSNAME"];
                classes_result.InnerHtml += "<div class=\"col5last\">" + classname + "</div>";

                classes_result.InnerHtml += "</div>";
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
             * An alternate way to fetch data without the SCHOOLDB.cs class
             * https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-sql-command.html
             */
            string query = "select * from students";
            var    db    = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                students_result.InnerHtml += "<div class=\"listitem\">";

                string studentfirstname = row["STUDENTFNAME"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentfirstname + "</div>";

                string studentlastname = row["STUDENTLNAME"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentlastname + "</div>";

                string studentnumber = row["STUDENTNUMBER"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentnumber + "</div>";

                string enrolmentdate = row["ENROLMENTDATE"];
                students_result.InnerHtml += "<div class=\"col4last\">" + enrolmentdate + "</div>";

                students_result.InnerHtml += "</div>";
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string query = "select * from teachers";
            var    db    = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                teachers_result.InnerHtml += "<div class=\"listitem\">";

                string teacherfirstname = row["TEACHERFNAME"];
                teachers_result.InnerHtml += "<div class=\"col5\">" + teacherfirstname + "</div>";

                string teacherlastname = row["TEACHERLNAME"];
                teachers_result.InnerHtml += "<div class=\"col5\">" + teacherlastname + "</div>";

                string teacheremployeenumber = row["EMPLOYEENUMBER"];
                teachers_result.InnerHtml += "<div class=\"col5\">" + teacheremployeenumber + "</div>";

                string teacherhiredate = row["HIREDATE"];
                teachers_result.InnerHtml += "<div class=\"col5\">" + teacherhiredate + "</div>";

                string teachersalary = row["SALARY"];
                teachers_result.InnerHtml += "<div class=\"col5last\">" + teachersalary + "</div>";

                teachers_result.InnerHtml += "</div>";
            }
        }