ส่วนของ Update ได้เขียนโค้ดต่อไปนี้นะค่ะ
<% @language=vbscript%>
<%
dim con
set con=server.createobject("ADODB.connection")
con.connectionstring="DSN=tour"
con.open
set rs=server.createobject("adodb.recordset")
rs.open "select * from package",con,1,3
Session("pkid")=Request.Form("pkid")
Session("pname")=Request.Form("pname")
Session("category")=Request.Form("category")
Session("duration")=Request.Form("duration")
Session("DOT")=Request.Form("DOT")
Session("place")=Request.Form("place")
Session("tar")=Request.Form("tar")
Session("seat")=Request.Form("seat")
rs.movefirst
while not rs.eof
if rs.fields(0)=request.form("pkid") then
rs("pkID")=Request.Form("pkid")
rs("pk_name")=Request.Form("pname")
rs("category")=Request.Form("category")
rs("duration")=Request.Form("duration")
rs("DOT")=Request.Form("DOT")
rs("palce_covered")=Request.Form("place")
rs("tariff")=Request.Form("tar")
rs("avail_seat")=Request.Form("seat")
rs.Update
else
rs.movenext
end if
wend
response.redirect "edit_suc.asp"
set con=nothing
set cmd=nothing
set rs=nothing
%>
ส่วนของ delete ก็มีโค้ดดังต่อไปนี้ค่ะ
<% @language=vbscript%>
<%
dim con
set con=server.createobject("ADODB.connection")
con.connectionstring="DSN=tour"
con.open
set rs=server.createobject("adodb.recordset")
rs.open "select * from package",con,2,3
rs.movefirst
while not rs.eof
if rs.fields(0)=request.form("pkid") then
delid = Request.Form("pkid")
con.Execute "DELETE * FROM package WHERE id="&delid
else
rs.movenext
end if
wend
response.redirect "del_suc.asp"
set con=nothing
set cmd=nothing
set rs=nothing
%>