[read.asp ¹®¼ ¸¸µé±â]
°Ô½ÃÆÇÀÇ Çü½ÄÀº ¹æ¹®°´ÀÌ À̸§°ú Á¦¸ñ°ú ³»¿ëÀ» ³²±â¸é ±Û¸ñ·Ï(list)¿¡¼´Â Á¦¸ñ¸¸ º¸¿©Áö°Ô ÇÏ°í Á¦¸ñÀ» Ŭ¸¯Çϸé
±× ³»¿ëÀÌ º¸¿©Áö°ÔÇÏ´Â °ÍÀÌ º¸ÅëÀÌ´Ù. µû¶ó¼ ¿ì¸®°¡ ÀÌ¹Ì ¸¸µé¾î ³õÀº list.asp¹®¼¿¡¼ Á¦¸ñºÎºÐ¿¡ ÇÏÀÌÆÛ¸µÅ©¸¦
°É¾î¼ Á¦¸ñÀ» Ŭ¸¯ÇÏ¸é ±× ³»¿ëÀ» º¸¿©ÁÖ´Â read.asp ¹®¼¸¦ ÀÛ¼ºÇÑ´Ù.
»ý°¢ÇØ¾ß ÇÒ °Í - Á¦¸ñÀ» ´©¸£¸é ±×¿¡ ÇØ´çÇÏ´Â ³»¿ëÀÌ º¸¿©Áö°Ô ÇÏ·Á¸é ÇÏÀÌÆÛ¸µÅ©¸¦ °É ¶§ Äõ¸®°ªÀ» °°ÀÌ Àü´ÞÇؾß
Çϴµ¥ °¢°¢ÀÇ ·¹ÄÚµåµéÀº °íÀ¯Å°°ª(ÀÏ·Ä ¹øÈ£)¸¦ °¡Áö°í ÀÖÀ¸¹Ç·Î ÀÌ Å¶°ªÀ» Äõ¸® °ªÀ¸·Î read.asp ¹®¼·Î
³Ñ°ÜÁÖ°í read.asp ¹®¼¿¡¼´Â Àü´Þ¹ÞÀº °íÀ¯Å°°ªÀ» °¡Áö°í ·¹ÄÚµå¼Â¿¡¼ ÀÌ¿¡ ÇØ´çÇÏ´Â Å°¸¦ °Ë»öÇÑÈÄ ±×
Å°¸¦ °¡Áö´Â ·¹Äڵ忡¼ ³»¿ë b_comment ºÎºÐ¸¸ Ãâ·Â½ÃÅ°¸é µÈ´Ù.
[list.asp ¹®¼ ¼öÁ¤Çϱâ] - ³»¿ëºÎºÐÀ» ¾ø¾Ö¹ö¸®°í Á¦¸ñ¿¡ ÇÏÀÌÆÛ¸µÅ©¸¦ °Ç´Ù.
Response.Write "<table border=1 width=500>"
& _
"<tr>" & _
"<td align=center>À̸§</td>" & _
"<td align=center>Á¦¸ñ</td>" & _
"</tr>"
Do while Not objRS.EOF Response.Write
"<tr>" &_ "<td align=center>"
& objRS("b_name") & "</td>" & _ "<td
align=center><a href=./read.asp?key=" & _ objRS("b_key")
& ">" & objRS("b_title") & "</a></td>" & _
"</tr>" objRS.MoveNext
Loop |
À§¿Í °°ÀÌ ¼öÁ¤ÇÑ ÈÄ ºê¶ó¿ìÀú·Î È®ÀÎÇÏ¸é ´ÙÀ½°ú °°´Ù.
ÀÌÁ¦ Á¦¸ñÀ» Ŭ¸¯Çϸé read.asp°¡ ¿¸®°í À̶§ Äõ¸® °ªÀ¸·Î key = "b_key" °ªÀ» Àü´ÞÇß´Ù´Â °ÍÀ»
±â¾ïÇÑ´Ù. ±×·¯¹Ç·Î Àü´Þ¹ÞÀº Äõ¸®°ªÀ» °¡Áö°í µ¥ÀÌÅͺ£À̽º¿¡¼ °Ë»öÀ» ÇÏ¿© ±× ·¹ÄÚµåÀÇ ³»¿ëÀ» ȸ鿡 »Ñ·ÁÁÖ´Â
read.asp ¹®¼¸¦ ´ÙÀ½°ú °°ÀÌ ÀÛ¼ºÇÑ´Ù.
<!--METADATA TYPE= "typelib" NAME=
"ADODB Type Library" FILE="C:\Program
Files\Common Files\SYSTEM\ADO\msado15.dll"--> <%
Option Explicit
Dim key
key = Request.QueryString("key")
Dim strConnect
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data
Source=C:\DataStore\board.mdb"
Dim objConn,SQL,objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnect
SQL = "select * from MyBoard where b_key LIKE " & key
Set objRS = objConn.Execute(SQL)
Response.Write "<table border=1 width=500>" & _
"<tr><td align=center>Á¦¸ñ</td></tr>" & _
"<tr><td align=center>" & objRS("b_comment") & "</td></tr>"
& _
"</table>"
Set objRS = nothing
Set objConn = nothing
%> |
read.asp¹®¼¸¦ ÀÛ¼ºÇÏ°í ÀúÀåÇÑÈÄ¿¡ list.asp ¹®¼¿¡¼ ¸µÅ©µÈ Á¦¸ñºÎºÐÀ» Ŭ¸¯ ÇÏ¸é ´ÙÀ½°ú °°Àº
°á°ú°¡ ³ª¿Â´Ù.
[¼³¸í]
ÀÌÀü¿¡ ¼³¸íÇÑ list.asp ¹®¼¿Í À¯»çÇÏ´Ù.´ÜÁö ·¹ÄÚµå¼ÂÀ» ¾òÀ»¶§ ÁúÀÇÇÏ´Â SQL ÁúÀǹ®ÇÏ°í Ãâ·Â ºÎºÐ¸¸
Ʋ¸®´Ù. SQL ÁúÀǹ®Àº Myboard¶ó´Â Å×ÀÔ¿¡¼ ¸ðµç Á¤º¸¸¦ ¼±ÅÃÇ쵂 Çʵå¸íÀÌ b_key°¡ list.asp
¹®¼¿¡¼ ÇÏÀÌÆÛ¸µÅ©·Î º¸³½ key Äõ¸®°ª°ú °°Àº °Í¸¸ »ÌÀ¸¶ó´Â °ÍÀÌ´Ù.
ÀÌ b_key´Â °íÀ¯°ªÀ̹ǷΠÀÏÄ¡ÇÏ´Â ·¹ÄÚµå´Â Çϳª¹Û¿¡ ¾ø´Ù. ÀÌ ÁúÀǹ®À» connection °³Ã¼ÀÇ Execute·Î
º¸³»¸é ·¹ÄÚµå¼ÂÀÇ ·¹ÆÛ·±½º°ªÀ» ¸®ÅÏ¹Þ¾Æ objRS¶ó´Â º¯¼ö¿¡ ÀúÀåÇÑ°ÍÀÌ´Ù. <- À̺κÐÀº C ¾ð¾îÀÇ Å¬·¡½º
ºÎºÐÀ» Âü°íÇϱ⠹ٶõ´Ù. C ¾ð¾î¸¦ ¹è¿îÀûÀÌ ¾ø°Å³ª C ¾ð¾î°¡ ¾àÇÏ´Ù¸é ±×³É ·¹ÄÚµå¼ÂµéÀÇ
Á¤º¸¸¦ ¾ò´Â±¸³ª ÇÏ´Â Á¤º¸·Î¸¸ ÀÌÇØÇصµ ¹«¹æÇÏ´Ù.
¾ÏÆ° ÀÌ·¸°Ô ÇÏ¸é ¿ì¸° ÀÌÁ¦ objRS¶ó´Â º¯¼ö¸¦ ÀÌ¿ëÇؼ ±×¾ÈÀÇ Á¤º¸¸¦ ¸ðµÎ »©³¾¼öÀִٴ°ÍÀÌ´Ù.
|
|