ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[±Ð¾Ç] (¹ê¾Ô±MÃD) ºô¸ô¸Õ¨÷ ¤U½g

[±Ð¾Ç] (¹ê¾Ô±MÃD) ºô¸ô¸Õ¨÷ ¤U½g

¿é¥X¸Õ¨÷

±NŪ¨ú¶i¨Óªº¡y¦Ò¸ÕÃD¥Ø¡zÅã¥Ü¦bºô­¶¤¤Åý¨ü´ú¾Ç¥Í§@µª¡A³o¬O¡yºô¸ô¸Õ¨÷¡Ð¸Õ¨÷ºô­¶¡zªº¥t¤@­ÓASPµ{¦¡¾÷¨î¡A§Ú­Ì±N³z¹L¦¹¾÷¨î§âŪ¨úªº¸ê®Æ®w¦ÒÃD¸ê®Æ¿é¥X¦Üºô­¶¤¤¡C
  1. <%
  2. 'Åã¥Ü¦ÒÃD
  3. 'Ū¨ú¸ê®Æªíªº¸ê®Æ¿ýª½¨ì¸ê®Æ¿ý¥þ³¡Åª¨ú§¹²¦
  4. DO While not recobject.EOF
  5. 'Åã¥ÜÃD¥Ø¤Î°t¤À
  6. Response.Write "<hr size=1><font color=blue>"&recobject(2)&_
  7. "¡B"&recobject(3)&"&nbsp&nbsp("&recobject(9)&"¤À)</font><br>"
  8. 'Åã¥Ü³Æ¿ïªºµª®×¶µ¥Ø
  9. For I= 1 to 4
  10. Response.Write "<font color=red>¡]"&I&"¡^</font><input type='"&"Radio"&_
  11. "' name='No"&recobject(2)&"' value="&I&">"&recobject("µª®×"&I)&"<br>"
  12. Next
  13. '±N¸ê®Æ¿ý¦V«á²¾¤@µ§,Åã¥Ü¤U¤@­ÓÃD¥Ø
  14. recobject.MoveNext
  15. Loop
  16. 'Ãö³¬¸ê®Æ®w
  17. recobject.CLOSE
  18. conobject.CLOSE
  19. %>
½Æ»s¥N½X


´£¥Ü
Response.write ¤èªk¡G­t³d±N¦r¦ê¸ê°T¿é¥X¦Ü¨Ï¥ÎªÌºÝ¡A¤]¥i»PHTML¼Ð¥Ü²V¦X¨Ï¥Î¡C¼Ð·ÇªºHTML¼ÐÅÒ¸ê®Æ¥iª½±µ®Ñ¼g©óASPµ{¦¡¤¤¡A³o¨Ç³æ¯ÂªºHTML¼ÐÅÒ¸ê®Æ¦bASPµ{¦¡°õ¦æ«á§Y·|­ì­ì¥»¥»ªºª½±µ¶Ç°eµ¹ÂsÄýªÌªºÂsÄý¾¹¶i¦æ¸ÑĶªº°Ê§@¡A¦ý¬O¡A¦pªG¬OÅܰʩʪº¸ê®Æ¡A¦p¤é´Á¡B®É¶¡µ¥¡A´N¥²¶·¨Ï¥Î Response ª«¥óªº ¡ywrite ¡z¤èªk¨Ó½s¼g¡C


question.asp
  1. <%
  2. '©Ó±µ¨Ó¦ÛIndoor.aspªº¾Ç¸¹¡B©m¦W¸ê®Æ
  3. studentname=Request("studentname")
  4. number=Request("number")
  5. '¶}±Òexam.mdb¸ê®Æ®w¤¤ªºfirst(ÃD¥Ø)¸ê®Æªí
  6. '«Ø¥ß¸ê®Æ®w³sµ²ª«¥óconobject
  7.    Set conobject = Server.CreateObject("ADODB.Connection")
  8. '§Q¥ÎMapPath¤èªk¨ú±o¸ê®Æ§¹¾ã¯u¹ê¸ô®|   
  9.    DBPath = Server.MapPath("exam.mdb")
  10. '§Q¥ÎOpen¤èªk¥´¶}¸ê®Æ®w      
  11.    conobject.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&DBPath
  12. '«Ø¥ß¦s¨ú¸ê®Æ®wª«¥órecobject      
  13.    Set recobject=Server.CreateObject("ADODB.Recordset")
  14.    SQL="SELECT * From "&"first"&" ORDER by ÃD¸¹"
  15.    recobject.Open SQL,conobject,1,1,1
  16. '¥ý±N¸ê®Æªíªº¸ê®Æ¿ý²¾¦Ü²Ä¤@µ§   
  17.    recobject.MoveFirst  
  18. %>
  19. <HTML>
  20. <HEAD>
  21. <TITLE>ºô¸ô¸Õ¨÷-¸Õ¨÷ºô­¶</TITLE>
  22. </HEAD>
  23. <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
  24. <div align="center"><font color="red" face="·s²Ó©úÅé" size="6">ºô¸ô¸Õ¨÷-¸Õ¨÷ºô­¶</font></div>
  25. <form action="grad.asp" method="get">
  26. <input type="hidden" name="studentname" value="<%=studentname%>">
  27. <input type="hidden" name="number" value="<%=number%>">  
  28. <%
  29. 'Åã¥Ü¦ÒÃD
  30. 'Ū¨ú¸ê®Æªíªº¸ê®Æ¿ýª½¨ì¸ê®Æ¿ý¥þ«×Ū¨ú§¹²¦
  31.   DO While not recobject.EOF
  32. 'Åã¥ÜÃD¥Ø¤Î°t¤À  
  33.   Response.Write "<hr size=1><font color=blue>"&recobject(2)&_
  34.                  "¡B"&recobject(3)&"&nbsp&nbsp("&recobject(9)&"¤À)</font><br>"
  35. 'Åã¥Ü³Æ¿ïªºµª®×¶µ¥Ø                 
  36.   For I= 1 to 4
  37.     Response.Write "<font color=red>¡]"&I&"¡^</font><input type='"&"Radio"&_
  38.     "' name='No"&recobject(2)&"' value="&I&">"&recobject("µª®×"&I)&"<br>"
  39.   Next
  40. '±N¸ê®Æ¿ý¦V«á²¾¤@µ§,Åã¥Ü¤U¤@­ÓÃD¥Ø  
  41.   recobject.MoveNext
  42.   Loop
  43. 'Ãö³¬¸ê®Æ®w  
  44.   recobject.CLOSE
  45.   conobject.CLOSE
  46. %>
  47. <hr size="1">
  48. <div align="center"><input type="submit" value="¥æ¨÷"></div>
  49. </form>
  50. </BODY>
  51. </HTML>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

µû¤À¤Î¤½§G¦¨ÁZ
·í¨ü´ú¾Ç¥Í¶ñ¼g¦n¸Õ¨÷¨Ã«ö¤U¡yºô¸ô¸Õ¨÷¡Ð¸Õ¨÷ºô­¶¡z¤¤ªº¡y¥æ¨÷¡z«ö¶s«á¡A´N·|³sµ²¶i¤J¡yµû¤À¤Î¤½§G¦¨ÁZ¡zªººô­¶¡A¦b¥»¨Ò¤¤§Ú­Ì±N³o­Óºô­¶ÀɮצWºÙ©w¬°¡G¡ygrad.asp¡z¦b³o­Óºô­¶¤¤ASPµ{¦¡±N¶i¦æ¤À¼Æªº­pºâ¡A¨Ã¥B±Nµû¤À«áªº¦¨ÁZ°e¦Ü¸ê®Æ®wÀɮפ¤Àx¦s¡A¤£¶È¦p¦¹¡AASPµ{¦¡ÁÙ·|°¨¤W±Nµû©wªº¦¨ÁZµ²ªG¥ß§YÅã¥Ü¦bºô­¶¤¤¡C²{¦b§Ú­Ì±µµÛ¨Ó¼¶¼g³o­Ó¡yµû¤À¤Î¤½§G¦¨ÁZ¡zªººô­¶»Pºô­¶¤¤ªºASPµ{¦¡¡C

¦b§Ú­Ìºô­¶¤¤¥D­nªºASPµ{¦¡¾÷¨î¤¤¡A§Ú­Ì±N­n¶i¦æ¡G


  • ³sµ²¸ê®Æ®w¨ÃŪ¨ú¸ê®Æ¤¤ªº¸ê®Æ¨Ó¶i¦æµª®×ªº¤ñ¹ï¡C
  • ¸ÕÃD§å§ï¨Ã±N§å§ïªºµ²ªG¿é¥X¦Üºô­¶¤¤¡C

    9-8.png

  • µû¤À¦¨ÁZ¦s¤J¸ê®Æ®wªº¸ê®Æªí¤¤¡C
  • ¦bµû¤À¦¨ÁZÀx¦s¨ì¸ê®Æ®w¤§«á§Ú­ÌÁÙ¥²¶·±N¦¨ÁZ¤½§G¥X¨Ó¡A¤£¦ý¦p¦¹§Ú­ÌÁÙ±N¼¶¼g¥t¤@­ÓASPµ{¦¡¨Ó§PÂ_¦¨ÁZ°ª§CªºÅã¥Ü¤è¦¡¡A¦¨ÁZ§C©ó¢µ¢¯¤ÀªÌ¤@«ß¥H¬õ¦â¦r¨ÓÅã¥Ü¡A¦P®ÉÁÙ·|¨Ì·Ó¤À¼Æªº°ª§C¨Ó±Æ©w¨ü´ú¦P¾Ç¬O¦º·íÁÙ¬O¦³¾÷·|¶i¦æ¸É¦Ò

    9-9.png


question.asp
  1. <%
  2. '©Ó±µ¨Ó¦Ûquestion.aspªº¸ê®Æ
  3. studentname=Request("studentname")
  4. number=Request("number")
  5. '¶}±Òexam.mdb¸ê®Æ®w¤¤ªºfirst¦ÒÃD¸ê®Æªí
  6. '¦b¦¹¶}±Ò¸ê®Æ®w¬O¥Î¨ÓŪ¨úµª®×»P¼g¤J­pºâ«áªº¦¨ÁZ
  7. '«Ø¥ß¸ê®Æ®w³sµ²ª«¥óconobject
  8.    Set conobject = Server.CreateObject("ADODB.Connection")
  9. '§Q¥ÎMapPath¤èªk¨ú±o¸ê®Æ§¹¾ã¯u¹ê¸ô®|      
  10.    DBPath = Server.MapPath("exam.mdb")
  11. '§Q¥ÎOpen¤èªk¥´¶}¸ê®Æ®w      
  12.    conobject.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&DBPath
  13. '«Ø¥ß¦s¨ú¸ê®Æ®wª«¥órecobject        
  14.    Set recobject=Server.CreateObject("ADODB.Recordset")   
  15. 'Ū¨ú¸ê®Æªí¤º®e   
  16.    SQL="SELECT * From "&"first"&" ORDER by ÃD¸¹"
  17.    recobject.Open SQL,conobject,1,1,1
  18. '¥ý±N¸ê®Æªíªº¸ê®Æ¿ý²¾¦Ü²Ä¤@µ§      
  19.    recobject.MoveFirst
  20. '¥ý±N­pºâªºÁ`¤À³]¬°¢¯   
  21.    Score=0
  22.    Response.Write "<div align=center><font color=green face=·s²Ó©úÅé size=6>ºô¸ô¸Õ¨÷-¦¨ÁZ§å§ï</font></div>"
  23. '±N¥¿½Tµª®×¤Î¨ü´ú¾Ç¥Í¿ïªºµª®×¤@°_Åã¥Ü¤ñ¹ï   
  24.    Do While Not recobject.EOF
  25.    Sel=Request("No"&recobject(2))
  26.    Ans=recobject(8)
  27. '­pºâ¦¨ÁZ¡Aµª¹ïªºÃD¥Ø¥[¤W¸ÓÃDÀ³±o¤À¼Æ
  28. '¦P®É§iª¾¸ÓÃD¥Ø¬Oµª¹ïÁÙ¬Oµª¿ù
  29.    IF Trim(Sel)=Trim(Ans) then
  30.           Score=Score+recobject(9)
  31.       RM="-->µª¹ï"
  32.    ELSE
  33.       RM="-->µª¿ù"
  34.    End IF
  35.    Ans=recobject(Ans+3)
  36.    yourans=recobject(Sel+3)
  37. '±N¸ÕÃD§å§ïªºµ²ªG¿é¥X¦Üºô­¶¤¤
  38.    Response.Write "<hr size=1>"&recobject(2)&_
  39.                  "&nbsp&nbsp"&recobject(3)&"<font color=red>"&RM&"</font><br>"
  40.    recobject.MoveNext
  41.    LOOP
  42.    recobject.CLOSE
  43.    conobject.CLOSE
  44. '¶}±Òexam.mdb¤¤ªºstudent¸ê®Æªí¡AÅã¥Ü¨ü´ú¾Ç¥Íªº¦¨ÁZ
  45.    Set conobject = Server.CreateObject("ADODB.Connection")
  46.    DBPath = Server.MapPath("exam.mdb")
  47.    conobject.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&DBPath
  48.    Set recobject=Server.CreateObject("ADODB.Recordset")
  49.    SQL="SELECT * From student where ¾Ç¸¹="&number&" and ©m¦W='"&studentname&"'"
  50.    recobject.Open SQL,conobject,1,3
  51.       recobject.MoveFirst
  52. '±N§å§ï«áªº¨ü´ú¾Ç¥Í¦¨ÁZ¦s¤J¸ê®Æ®w¤¤
  53.       recobject("first")=Score
  54.       recobject.Update
  55. %>
  56. <HTML>
  57. <HEAD>
  58. <TITLE>ºô¸ô¸Õ¨÷-¦¨ÁZ§å§ï</TITLE>
  59. </HEAD>
  60. <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
  61. <hr size="1">
  62. <!-- Åã¥ÜÀ³¦Ò¾Ç¥Íªº¸ê®Æ -->
  63. <table align="center" border="0" width="50%">
  64. <tr><td align="center" width="50%"><font color="blue">
  65. ©m¦W¡G<%=studentname%></font></td>
  66. <td align="center" width="50%"><font color="blue">
  67. ¾Ç¸¹¡G<%=number%></font></td></tr>
  68. </table>
  69. <!-- Åã¥ÜÀ³¦Ò¾Ç¥Íªº¦¨ÁZ -->
  70. <table align="center" border="1" width="50%">
  71. <tr><td align="center" width="50%">¦Ò¸Õ¶i«×</td><td align="center" width="50%">¤À¼Æ</td></tr>
  72. <tr><td align="center">¥»¦¸´úÅ禨ÁZ</td><td align="center">
  73. <!--±N¦¨¿n¤£¤Î®æªº¤À¼Æ¥H¬õ¦âÅã¥Ü-->
  74. <%
  75.   IF Score<50 THEN
  76. Response.Write "<font color=red>"&Score&"¤À,¦º·í</font>"
  77.   ELSEIF Score<60 THEN
  78. Response.Write "<font color=red>"&Score&"¤À,¸É¦Ò</font>"
  79.   ELSE
  80. Response.Write Score&"¤À,¤Î®æ"
  81.   END IF
  82. recobject.CLOSE
  83. conobject.CLOSE
  84. %>
  85. </td></tr>
  86. </table>
  87. <hr size="1">
  88. <p>
  89. <!-- ­«·s¶ñ¼g´úÅç¨÷ -->
  90. </p>
  91. <divalign="center">
  92. <a ref="indoor.asp?studentname=<%=studentname%>&number=<%=number%>">[¦A¦Ò¤@¦¸]</div>
  93. </BODY>
  94. </HTML>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¨Ï¥ÎAccess¨Ó«Ø¥ß¸ê®Æ®w»P¸ê®Æªí
¦b¥»½d¨Ò¤¤§Ú­Ì±N¾Ç¥Í¸ê®Æ¡A¦ÒÃDÃD¥Ø»Pµª®×¡B¦¨ÁZ­pºâµ²ªGµ¥¤T¶µ¸ê®Æ°O¿ý©ñ¦b¸ê®Æ®wÀɮפ¤¡A¦Ó§Ú­Ì©Ò¨Ï¥Îªº¸ê®Æ®w¬°Access®æ¦¡ªº*.mdb¸ê®Æ®wÀɮסA±µ¤U¨Ó´N¬°¦U¦ì²³æªº¤¶²Ð¦p¦ó«Ø¥ß³o­Ó¸ê®Æ®wÀɮסC


  • ¶}±Ò Access ¡A¿ï¾Ü¡yAccessªÅ¥Õ¸ê®Æ®w¡z¨Ó«Ø¥ß·sªº¸ê®Æ®w¡A±µµÛ©ó¡y¶}·s¸ê®Æ®w¡z¹ï¸Üµøµ¡¤¤ªº¡yÀɮצWºÙ¡zÄæ¦ì¤¤¿é¤J§Ú­Ìªº¸ê®Æ®wÀɦW¡yexam.mdb¡z¡AµM«á«ö¤U«Ø¥ß«ö¶s¡G

    9-10.png

    9-11.png

  • ±µµÛ´N·|¥X²{¤@­Ó¡yexam:¸ê®Æ®w¡z¹ï¸Üµøµ¡¡A¦b³o­Ó¹ï¸Üµøµ¡¤¤¡A¥ª°¼ªº¿ï¶µÄ椤§A·|µo²{¡y¸ê®Æªí¡z¶µ¥Ø¬O¤U¥W¦Ó³Q¿ï¨úªº¡A¦¹®É½ÐÂùÀ»·Æ¹«¥ªÁä¿ï¨ú¹ï¸Üµøµ¡¥k°¼Äæ¦ì¤¤ªº¡y¨Ï¥Î³]­pÀ˵ø«Ø¥ß¸ê®Æªí¡z¨Ó«Ø¥ß§Ú­Ì©Ò»Ýªº¸ê®Æ®w¸ê®Æªí¡G

    9-12.png

  • ¦b¥X²{ªº¸ê®Æªí³]­pµøµ¡¤¤½Ð¦b¡yÄæ¦ì¦WºÙ¡zÄæ¦ì¤¤¨Ì§Ç¿é¤J¡G«¬¦¡¡BÃD¸¹¡B¸ÕÃD¤º®e¡Bµª®×¡Bµª®×¡Bµª®×¡Bµª®×¡BANS¡B°t¤Àµ¥¶µ¥Ø¡A¦P®É¦b¡y¸ê®ÆÃþ«¬¡zÄæ¦ì¤¤¨Ì§Ç¬°¦U­ÓÄæ¦ì¶µ¥Ø¿ï¨ú¬Û¹ïÀ³ªº¸ê®ÆÃþ«¬¡G¤å¦r¡B¼Æ¦r¡B¤å¦r¡B¤å¦r¡B¤å¦r¡B¤å¦r¡B¤å¦r¡B¼Æ¦r¡B¼Æ¦r¡C

    9-13.png

  • ±µµÛ«ö¤U¤u¨ã¦C¤Wªº¡y¦sÀÉ¡z«ö¶s¡A±N³o±i¸ê®ÆªíÀx¦s¬°¡yfirst¡z¡A¦A«ö¤U½T©w«ö¶s«áAccess·|°Ý§Ú­Ì­n¤£­n«Ø¥ß¥D¯Á¤Þ¡A¿ï¬O©Î§_³£¥i¥H¡A¤p»x¬O¿ï¡y¬O¡z°Õ¡I

    9-14.png

  • ¦^¨ì¡yexam:¸ê®Æ®w¡z¹ï¸Üµøµ¡«á¡A¦b³o­Ó¹ï¸Üµøµ¡¤¤¡A¥k°¼ªºÄæ¦ì¤¤§A·|µo²{¦h¤F¤@­Ó¡yfirst¡z¸ê®Æªí¶µ¥Ø¡A¦¹®É½Ð¦b³o­Ó¡yfirst¡z¸ê®Æªí¶µ¥Ø¤WÂùÀ»·Æ¹«¥ªÁä¨Ó¶}±Ò¡yfirst¡z¸ê®Æªí¶i¦æ¸ê®Æªí¤º®eªº½s¿è¡G

    9-15.png

  • ½Ð¦b¶}±Òªº¸ê®Æªíµe­±¤¤¡A¨Ì¦UÄæ¦ì¶i¦æÃD¥Øªº½s¿è¤u§@¡A¯S§Oª`·N¤@¤U¡A«¬¦¡Äæ¦ìªº¡y³æ¡z·N«ä¬O»¡§Ú­ÌªºÃD¥Ø¬O³æ¿ïÃD¡A¦Ó¡yANS¡zÄæ¦ì¤º®e«h¬°ÃD¥Øªº¥¿½Tµª®×¡C

    9-16.png

  • ½Ð¨Ì·Ó¨BÆJ¢±~¢µªº»¡©ú«Ø¥ß¥t¤@­Ó¦s©ñ¨ü´ú¾Ç¥Í©m¦W¡B¾Ç¸¹¤Î¤À¼Æªº¡ystudent¡z¸ê®Æªí¡C

    9-17.png


¡@½Ðª`·N¡G
¨ü´ú¾Ç¥Í¦W³æªº©m¦W»P¾Ç¸¹°È¥²¥ý¦æ«Ø¥ß©ó¸ê®Æ®wªº¸ê®Æªí¤¤¡A§_«h¦b¡yºô¸ô¸Õ¨÷¡Ð¸Õ³õ¤jªù¡zºô­¶ªºASPµ{¦¡Åª¨ú¸ê®Æ®w¤¤ªº¨ü´ú¾Ç¥Í¦W³æ¸ê®Æ¨Ó»P¨ü´ú¾Ç¥Í©Ò¶ñªº¸ê®Æ§@¤ñ¸û®É¡A¦pªG¨ü´ú¾Ç¥Í©Ò¶ñªº¸ê®Æ¤£¦b¸ê®Æªí¦W³æ¤W±N·|¥X²{¿ù»~°T®§¡A¦Ü©ó¡yfirst¡zÄæ¦ì«h¬O¥Î¨Ó¬ö¿ý¡yµû¤À¤Î¤½§G¦¨ÁZ¡zªººô­¶¤¤ASPµ{¦¡©Ò¶i¦æªº¤À¼Æ­pºâµ²ªG¡C


(¹ê¾Ô±MÃD) ºô¸ô¸Õ¨÷§¹¾ã½d¨ÒÀ£ÁYÀɤU¸ü¡G eask.zip (18.08 KB)
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : ¤£©È¨Æ¦h¡A¥u©È¦h¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD