<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">IIM</journal-id><journal-title-group><journal-title>Intelligent Information Management</journal-title></journal-title-group><issn pub-type="epub">2160-5912</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/iim.2017.96013</article-id><article-id pub-id-type="publisher-id">IIM-80107</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  Database Development Based on MFC Application in Management of Curriculum Information
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Mao</surname><given-names>Wang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Tuo</surname><given-names>Chen</given-names></name><xref ref-type="aff" rid="aff2"><sup>2</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Yong</surname><given-names>Jiang</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib></contrib-group><aff id="aff2"><addr-line>National Space Science Center, Beijing, China</addr-line></aff><aff id="aff1"><addr-line>China University of Geosciences, Beijing, China</addr-line></aff><author-notes><corresp id="cor1">* E-mail:<email>wangmao@cugb.edu.cn(MW)</email>;</corresp></author-notes><pub-date pub-type="epub"><day>01</day><month>11</month><year>2017</year></pub-date><volume>09</volume><issue>06</issue><fpage>236</fpage><lpage>244</lpage><history><date date-type="received"><day>25,</day>	<month>September</month>	<year>2017</year></date><date date-type="rev-recd"><day>29,</day>	<month>October</month>	<year>2017</year>	</date><date date-type="accepted"><day>1,</day>	<month>November</month>	<year>2017</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  There are hundreds of records in the curriculum of our Language Learning Lab every semester and every record has several important properties. It takes too much time to manage the information in the traditional way and it always makes mistakes. Managing the information with database technology, designing program to access the database with Visual c tool, setting a combobox in the application UI and inquiring curriculum information by selecting the room name in the combobox. It is easy to operate the program for the staff members. The result is accurate, this way promotes the efficiency of managing information.
 
</p></abstract><kwd-group><kwd>Curriculum Information</kwd><kwd> Database</kwd><kwd> Programming Skill</kwd><kwd> Microsoft Foundation Classes</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Present Curriculum Management in Language Learning Center</title><p>Foreign language is an important course for college students and all the freshmen need to study language course in learning center. There are more than 200 language courses in learning center every semester. Every course includes day of the week, lesson time, room, teacher, lesson name, class name. We got the excel file includes course information from the office of academic affairs at the beginning of the semester. We can see the <xref ref-type="fig" rid="fig1">Figure 1</xref>. We can sort there cords simply with excel software.</p><p>Lab technicians get the course information. They need to order the informa-</p><p>tion by day of the week, lesson time, room number and then they can use it conveniently. It takes 1 day to order the hundreds of records manually. The paper applies database technology [<xref ref-type="bibr" rid="scirp.80107-ref1">1</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref2">2</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref3">3</xref>] to manage the course information with MFC program, so it solves the problem efficiently. In the MFC environment we can design the convenient user interface [<xref ref-type="bibr" rid="scirp.80107-ref4">4</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref5">5</xref>] and generate the choices automatically. The result is order by day of week; different records are shown in different colors. It is easy to find the records we need.</p></sec><sec id="s2"><title>2. Query and Simple Sort of Database</title><sec id="s2_1"><title>2.1. Course Information Query and Simple Sorting</title><p>When we sort the course records of the learning center, we can know the room which is available sometime. We can maintain the equipment of the room in the vacant time, so query function is very important.</p><p>Introduction of SQL sentence [<xref ref-type="bibr" rid="scirp.80107-ref6">6</xref>] . We can input command to operate the database. The grammar is as follows.</p><p>SELECT column name FROM table name. We can add other condition, such as where, order by [<xref ref-type="bibr" rid="scirp.80107-ref7">7</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref8">8</xref>] . The column name is the property.</p><p>Example of SELECT sentence (query course information of room 505 and order by day of week).</p><p>Select sentence is as follows. SELECT * FROM room where 教室 = “教5楼505” order by 星期asc. Select is query. Room is the table name, 教室、星期is the attribute of the table. The data is order by day of week ascending. The result is shown as <xref ref-type="fig" rid="fig2">Figure 2</xref>.</p><p>In <xref ref-type="fig" rid="fig2">Figure 2</xref>, we can get the course records of “教五楼505”, and it’s sorted by day of week. It shows records of Monday, Tuesday and so on. The lesson time</p><p>column for Monday shows “第3, 4节”, “第1, 2节”, “第9 - 11节”, “第5, 6节”, “第7, 8节”. The information is unordered. It is used inconveniently.</p></sec><sec id="s2_2"><title>2.2. Course Information Query and Complex Sorting</title><sec id="s2_2_1"><title>2.2.1. Query the Course Information for a Room and Complex Order</title><p>Example of SELECT sentence (course records query of room 505 and order by day of week, lesson), SELECT sentence is as follows.</p><p>SELECT * FROM room where 教室 = “教5楼505” order by 星期, 节次asc “Order by星期,节次asc” [<xref ref-type="bibr" rid="scirp.80107-ref9">9</xref>] means that query the course information sorted by day of week ascending, and then sorted by lesson time for every day ascending. The result is shown as <xref ref-type="fig" rid="fig3">Figure 3</xref>.</p><p>In <xref ref-type="fig" rid="fig3">Figure 3</xref>, we can get the course records of room 505, and the result is sorted by day of week and lesson time. When we use SQL sentence to query the records, we can know the information of room 505 accurately and the result is ordered.</p></sec><sec id="s2_2_2"><title>2.2.2. Course Records Query for All the Room in the Learning Center</title><p>When a teacher wants to change a room, the technician needs to know the vacant room at a time. We need to query the course records order by “星期、节次、教室号”. The SQL sentence is as follows. SELECT * FROM room order by 星期,节次, 教室asc. The result is shown as <xref ref-type="fig" rid="fig4">Figure 4</xref>.</p><p>When we use the SQL sentence, we can see which room is occupied at a time, and the records are sorted by day of week, lesson time, room. It’s very convenient to modify the course information. If a room is vacant at a time, a teacher can add a lesson in the room.</p></sec></sec></sec><sec id="s3"><title>3. MFC Structure and Program Designing</title><p>We can query data in database and it is very efficient. When lab technician wants to use it easily, we need to design software with MFC structure. The paper design an MFC program to query the course database, and it is easily for lab technician to operate [<xref ref-type="bibr" rid="scirp.80107-ref10">10</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref11">11</xref>] .</p><sec id="s3_1"><title>3.1. The MFC Frame Structure</title><p>Visual studio is a developing toolkit and is a developing environment pushed out by Microsoft Company. We design the program with MFC library. MFC means Microsoft Foundation Classes. When we create an MFC project, the project will generate 4 classes [<xref ref-type="bibr" rid="scirp.80107-ref12">12</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref13">13</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref14">14</xref>] (the view, the doc, the main Frame, the app). It is very convenient for programmer to design software in windows environment. The MFC frame defines the frame and offers the standard ways for user interface. The programer adds the functions in the frame.</p><p>CDocument: it is a document class [<xref ref-type="bibr" rid="scirp.80107-ref15">15</xref>] , the memory data communicates with database data with it. CView: it is view class. Users communicate with the memory data [<xref ref-type="bibr" rid="scirp.80107-ref16">16</xref>] with it and it includes interface and on draw function.</p><p>We add a combobox in the toolbar. The combox accesses the database and gets the course information. When the program is initiated, it adds the room number in the combobox. The user doesn’t need to type the room number.</p><p>CStringsel = “SELECT 教室 FROM room group by 教室”. The SQL sentence can query the room number and the records of same room number can generate one room number. The number is sorted.</p><p>The variable frame is the pointer of Mainframe in view class, frame-&gt;m_wndToolBar.m_combo_room. AddString (strRoom). Add the room number in the combobox, room number is queried form database. strRoom is the room number from database.</p><p>When user chooses room number, the room number will be the variable m_strobj Room. The program will operate invalidate (TRUE) to call the On Draw function, then the visual region will be refreshed [<xref ref-type="bibr" rid="scirp.80107-ref17">17</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref18">18</xref>] .</p></sec><sec id="s3_2"><title>3.2. Operating Database</title><p>1) Opening database</p><p>_ConnectionPtr m_pConnection; Define the variable to connect the database.</p><p>m_pConnection-&gt;Open(“Provider = Microsoft.Jet.OLEDB.4.0;Data Source = room.mdb”,”“,”“,adModeUnknown);</p><p>The second parameter DataSource is the database name.</p><p>(2) Generatingsqlsentenceautomatically according the user’s demand.</p><p>if(strcmp(m_strobjRoom,”全部”)==0)</p><p>{</p><p>sel.Format(“SELECT * FROM room order by 星期, 节次, 教室”);</p><p>}</p><p>else</p><p>{</p><p>sel.Format(“SELECT * FROM room where 教室=‘%s’ order by 星期,节次 “,m_strobjRoom);</p><p>}</p><p>According the user’s choice the program generates the SQL sentence. If the user chooses all the room, we query all the room in the course database. If the user chooses one room, the program generates the SQL sentence to query the course information for the room. The variable m_strobjRoom is the selected room number. When the user chooses all the room, the program generate the first SQL sentence. When the user chooses one room, the program generates the second SQL sentence.</p><p>3) Query data from the database and get result.</p><p>_RecordsetPtrm_pRecordset; Define the variable to receive data</p><p>m_pRecordset.CreateInstance(__uuidof(Recordset));</p><p>m_pRecordset-&gt;Open(_bstr_t(sel), //sel is the SQL sentence.</p><p>m_pConnection.GetInterfacePtr(), //get the database connection pointer</p><p>adOpenDynamic,</p><p>adLockOptimistic,</p><p>adCmdText);</p><p>Through opening operation, we can get result in variable m_pRecordset.</p><p>4) Traverse all the record</p><p>m_pRecordset-&gt;MoveNext(), move tothe next record.</p><p>m_pRecordset-&gt;adoEOF. The function checks whether the record is the last one. It always used in while circulation to traverse data [<xref ref-type="bibr" rid="scirp.80107-ref19">19</xref>] [<xref ref-type="bibr" rid="scirp.80107-ref20">20</xref>] .</p></sec><sec id="s3_3"><title>3.3. The Result Is Shown in the View Class</title><p>There is a function called on draw in view class. The result is shown with the function. In order to make it easy to be found for user, the record in a day of week is set a color. For example the data of Monday is green, Tuesday is red.</p><p>pDC-&gt;SetTextColor(RGB(255,0,0)). The function set text color can set color for data. The value in RGB is different then the color is different.</p><p>pDC-&gt;TextOut(ptorigin.x+xnstep1,ptorigin.y,strClass). The function prints the records in the view. The variable ptorigin is the origin point. When the next record is shown, ptorigin. y is added a step length. When we traverse the data, all the records are shown in the view with different color.</p></sec><sec id="s3_4"><title>3.4. The Program Flow Char and Operation Interface</title><p>The program includes several steps.</p><p>1) The program initiates MFC frame and generates the mainframe and the view.</p><p>2) The program Accesses the database and gets the course information. It adds the room number in the combobox.</p><p>3) The user chooses the choice in the combobox. The program generates SQL sentence.</p><p>4) The program opens the Room database, queries the information and gets result.</p><p>5) The result is shown in the view. The record’s color of different day is different. Close the database. If the user continues to query, go to step 3.</p><p>The flow chart is shown as <xref ref-type="fig" rid="fig5">Figure 5</xref>.</p><p>The program’s interface and the result is shown as <xref ref-type="fig" rid="fig6">Figure 6</xref>. The combobox is shown in the red ellipse. The user can choose room number in the combobox. The result is the course information of 教5楼312. The data’s color from Monday to Friday is different and course information is sorted by day of week, lesson time, it is easy find a record.</p></sec></sec><sec id="s4"><title>4. The Conclusion</title><p>We design a program to access database with Visual studio; it can manage the course information efficiently. When the program query the database, the query time is less than 1 second (the count of records is several hundred). It is more convenient than the traditional way. The course information’s color is different, so we can find information easily. The user doesn’t need to study the database knowledge and SQL sentence. It can run in OS win 7 win 10 and so on. It solves</p><p>the problem efficiently. The program is appropriate for managing curriculum for the office of academic affairs.</p></sec><sec id="s5"><title>Fund</title><p>The paper is supported by China University of Geosciences (Beijing) basic research funding (2-9-2017-096).</p></sec><sec id="s6"><title>Cite this paper</title><p>Mao, W., Chen, T. and Jiang, Y. (2017) Database Development Based on MFC Application in Management of Curriculum Information. Intelligent Information Management, 9, 236-244. https://doi.org/10.4236/iim.2017.96013</p></sec></body><back><ref-list><title>References</title><ref id="scirp.80107-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Liu, G. and Lu, Y.J. (2016) Access Database Technology and Application. China Railway Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Tang, H.K. (2016) Database Technology and Application. Electronic Industry Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Zhang, J.L. (2016) Database Technology and Experiment Course. Zhejiang University Press, Hangzhou.</mixed-citation></ref><ref id="scirp.80107-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Qian, L.P. Wang, L.D. and Zhang, J. (2016) Object-Oriented Programming C++ Edition. China Machine Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Chen, L.M., Zhan, L.C.H. and Min, F. (2016) C++ Object-Oriented Programming. China Electric Power Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Chen, C.H. (2010) Tutorial of Access Database. China Railway Publishing House, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Huang, K., Bai, Y.N. et al. (2014) Access Database Knowledge and Application. Tsinghua University Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Wang, A.L., Guo, S.X., Gui, Z.S. and Liu, Y. (2016) Tutorial of Access Database Example. Tsinghua University Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Zheng, A.Q. (2012) Tutorial of SQL Server Database (2008 Edition). Posts and Telecom Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Wang, H. (1999) Master Visual C++. Electronic Industry Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Yang, X.L., Zhang, Q. and Yang, L. (2016) Visual Programming Designed. Beijing Institute of Technology Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Wang, D.H. and Li, Y. (2016) Mastering VISUAL C++ Programming. Posts and telecom Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Qiu, G.F. (2015) MFC Programming Based on Visual C++. Tsinghua University Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">Wang, H.T. (2016) Data Structure. Shanghai Jiao Tong University Press, Shanghai.</mixed-citation></ref><ref id="scirp.80107-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Wen, X.M. and Ding, X.J. (2013) Visual C++ Object-Oriented Programming and Experiment. Tsinghua University Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">Chuai, J.H. and Yuan, Q. (2016) Object-Oriented Programming and VC++ Application. Tsinghua University Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">Hu, X.G. and Zhang, X.Y. (2016) Data Structure. Anhui University Press, Hefei.</mixed-citation></ref><ref id="scirp.80107-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">Lin, R. and Han, Y.Q. (2012) High Quality Programming Guide: C++/C Language. Electronic Industry Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref19"><label>19</label><mixed-citation publication-type="other" xlink:type="simple">Yan, W.M., Li, D.M. and Wu, W.M. (2016) Data Structure. C Language Edition, The Second Edition, Posts and Telecom Press, Beijing.</mixed-citation></ref><ref id="scirp.80107-ref20"><label>20</label><mixed-citation publication-type="other" xlink:type="simple">Li, Z.H. and Liu, W.D. (2016) Object-Oriented Programming. The Second Edition, Tsinghua University Press, Beijing.</mixed-citation></ref></ref-list></back></article>