コード例 #1
0
        public static List <StudentCourse> getCourses()
        {
            List <StudentCourse> studentCourses = new List <StudentCourse>();

            try
            {
                string sql = "SELECT * FROM Course";

                DataSet          ds   = new DataSet();
                OleDbConnection  conn = new OleDbConnection(MSAccessMethods.connStr);
                OleDbCommand     cmd  = new OleDbCommand(sql, conn);
                OleDbDataAdapter da   = new OleDbDataAdapter(cmd);
                da.Fill(ds);
                studentCourses = OracleMethods.mapStudentCourses(ds);
            }
            catch (Exception ex)
            {
            }
            return(studentCourses);
        }
コード例 #2
0
        public static StudentCourse getCourse(int id)
        {
            StudentCourse course = new StudentCourse();

            try
            {
                string sql = "SELECT * FROM Course " +
                             "WHERE course_no = ?";

                DataSet         ds   = new DataSet();
                OleDbConnection conn = new OleDbConnection(connStr);
                OleDbCommand    cmd  = new OleDbCommand(sql, conn);
                cmd.Parameters.AddWithValue("@course_no", id);
                OleDbDataAdapter da = new OleDbDataAdapter(cmd);
                da.Fill(ds);
                course = OracleMethods.mapStudentCourse(ds.Tables[0].Rows[0]);
            }
            catch (Exception ex)
            {
            }

            return(course);
        }