<%
' ถ้ากำหนด dim connect,sql จะ error : Name redefined
' เพราะเรียกโปรแกรมภายนอก selecttab.asp แต่โปรแกรมนั้นกำหนด dim ไว้แล้ว
' dim connect, sql
dim gtmpch, gtmpnum, toconfirm, found
found = 0
gtmpnum = request.form("gtmpnum")
gtmpch = request.form("gtmpch")
toconfirm = request.form("toconfirm")
set connect = server.createobject("ADODB.Connection")
connect.open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &_
Server.MapPath("\perlphpasp\db\tempdb.mdb"))
if toconfirm = "yes" then
sql="update tempfile set tmpnum = "& gtmpnum
sql=sql & " where tmpch ='" & gtmpch & "'"
connect.execute(sql)
connect.close
set connect = nothing
response.write("Edit : ok")
else
sql = "select * from tempfile"
set rs = connect.execute(sql)
do while not rs.eof
if trim(rs("tmpch")) = gtmpch then ' trim จะลบช่องว่างทั้งซ้ายและขวา
found = 1
end if
rs.movenext
loop
connect.close
set rs = nothing
set connect = nothing
if found = 1 and len(gtmpnum) > 0 then
response.write("<form action=edittmpnum.asp method=post>")
response.write("<input type=hidden name=gtmpnum value=" & gtmpnum & ">")
response.write("<input type=hidden name=gtmpch value='" & gtmpch & "'>")
response.write("<br>Your request : " & gtmpch & " - " & gtmpnum & "<br>")
response.write("<input type=hidden name=toconfirm value=yes>")
response.write("<input type=submit value=Confirm>")
response.write("</form>")
else
response.write("Not found or tmpnum equal 0")
end if
end if
%><br>
<! ด้านล่างทำงานแบบ ssi (Server Side Includes) แต่บรรทัดนี้เป็น comment ใน html>
<!--#include file=selecttab.asp-->
จำนวน : 46 บรรทัด