<%
dim connect, rs, sql, ctr,recaddr, recnum, totrs
ctr = request.querystring("ctr")
recnum = request.querystring("recnum")
if (len(recnum) < 1) then recnum = 0
set connect = server.createobject("ADODB.Connection")
connect.open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &_
Server.MapPath("\perlphpasp\db\tempdb.mdb"))
sql = "select * from tempfile"
set rs = connect.execute(sql)
totrs = 0
rs.movefirst
do while not rs.eof
totrs = totrs + 1
rs.movenext
loop
rs.movefirst
if totrs > 0 then
select case ctr
case "first"
recnum = 0
case "prev"
if recnum = 0 then
recnum = totrs - 1
else
recnum = recnum - 1
end if
case "next"
tnext = totrs - 1
if int(recnum) >= int(tnext) and recnum <> "0" then
recnum = 0
else
recnum = recnum + 1
end if
case "last"
recnum = totrs - 1
end select
rs.move recnum
response.write("<body>"& recnum + 1 &" / "& totrs &"<br>")
response.write("<a href=controlrec.asp?ctr=first&recnum="&recnum&">first</a> - ")
response.write("<a href=controlrec.asp?ctr=prev&recnum="&recnum&">prev</a> - ")
response.write("<a href=controlrec.asp?ctr=next&recnum="&recnum&">next</a> - ")
response.write("<a href=controlrec.asp?ctr=last&recnum="&recnum&">last</a><hr> - ")
response.write(rs("tmpch")&"<br>")
response.write(rs("tmpnum")&"<br>")
response.write(rs("tmpdate")&"<br>")
else
response.write("Record not found")
end if
connect.close
set rs = nothing
set connect = nothing
%>
จำนวน : 53 บรรทัด