+++ ȨÁ¦ÀÛ ¹ÙÀ̺í +++
ȨÁ¦ÀÛ ¹ÙÀ̺í ÀÌ »çÀÌÆ®´Â ÀÌ¿µÂù´ÔÀÇ »çÀÌÆ®¸¦ º¹¿øÇÑ °ÍÀÔ´Ï´Ù.
Untitled Document
Html
Dhtml
Css
Php
Asp
Cgi
Java Script
Java Applet
Multimedia
Win Tip
°èÃþÇü°Ô½ÃÆǸ¸µé±â (2)
°èÃþÇü°Ô½ÃÆǸ¸µé±â°­Á´ ÀÌ¹Ì ¼±ÇàÇÑ °Ô½ÃÆǸ¸µé±â¸¦ ÇнÀÇÑ »ç¶÷À» ´ë»óÀ¸·Î ÇÏ°Ú½À´Ï´Ù. ¸ÕÀú °£´ÜÇÑ access ÆÄÀÏÀ» ´ÙÀ½°ú °°ÀÌ ÀÛ¼ºÇÕ´Ï´Ù.



(1) Write.asp ¹®¼­

<form method=POST action=insert.asp>
<table border=1 width=400>
<tr>
<td align=center>Á¦¸ñ</td>
<td><input type=text name=title size=50></td>
</tr>
<tr>
<td align=center>À̸§</td>
<td><input type=text name=name size=50></td>
</tr>
<tr>
<td align=center>±Û</td>
<td><textarea rows=10 name=comment cols=50></textarea></td>
</tr>
<tr>
<td align=right colspan=2>
<input type=submit value=±ÛÀúÀå>
</td></tr>
</table>
</form>


(2) Insert.asp ¹®¼­

<!--METADATA TYPE= "typelib"  NAME= "ADODB Type Library"
      FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll"  -->
<%


Dim name, title, comment
name = Request.form("name")
title = Request.form("title")
comment = Request.form("comment")

Dim strConnect
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\DataStore\rboard.mdb"

Set CON = Server.CreateObject("ADODB.Connection")
CON.Open strConnect
SQL = "select MAX(b_ref) from MyBoard"
Set RS = CON.Execute(SQL)

If IsNULL(RS(0)) Then
    ref = 1
else
    ref = RS(0) + 1
End If

Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open "Myboard", strConnect, adOpenStatic, adLockPessimistic, adCmdTable

with RS
    .AddNew
    .Fields("b_name") = name
    .Fields("b_title") = title
    .Fields("b_comment") = comment
    .Fields("b_ref") = ref
    .Fields("b_pos") = 1
    .Fields("b_depth") = 1
    .Update
    .Close
end with
Set RS = nothing
Set CON = nothing
response.redirect "list.asp"
%>

Update : 2001/05/29 [µ¹¾Æ°¡±â]