<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="PreRs.asp">
<div align="center">
<table width="100%" border="0">
<tr>
<td width="26%">
<div align="right">Authors : </div>
</td>
<td width="74%">
<select name="List">
<%
sql="select DISTINCT au_lname from authors"
set rs_list=conn.Execute(sql)
if rs_list.eof then
Response.Write "<option value=''>No Author</option>"
else
do while not rs_list.eof
Response.Write "<option value=" & rs_list("au_lname") & ">" & rs_list("au_lname") & "</option>"
rs_list.movenext
loop
end if
rs_list.close
set rs_list=nothing
%>
</select>
</td>
</tr>
</table>
<input type="submit" name="Submit" value="search">
<input type="hidden" name="action">
</div>
</form>
<%
au_lname=Request.Form ("list")
au_lname=replace(au_lname,"'","''")
action=Request("action")
if action="movenext" then
'得到后一条记录
record=Request("record")
record=replace(record,"'","''")
set OUTRS=server.CreateObject ("adodb.recordset")
STRSQL="select * from authors order by au_lname"
OUTRS.Open STRSQL,conn,1,1
OUTRS.Find "au_lname='" & record & "'"
if OUTRS.eof then
Response.Write "No Record"
Response.End
else
OUTRS.MoveNext
OUTRS.movenext
if OUTRS.EOF then
Response.Write "No"
no_next=true
else
Response.Write "yes"
no_next=false
end if
OUTRS.moveprevious
end if
elseif action="moveprev" then
'得到前一条记录
record=Request("record")
record=replace(record,"'","''")
set OUTRS=server.CreateObject ("adodb.recordset")
STRSQL="select * from authors order by au_lname"
OUTRS.Open STRSQL,conn,1,1
OUTRS.Find "au_lname='" & record & "'"
if OUTRS.eof then
Response.Write "No Record"
Response.End
else
OUTRS.Moveprevious
OUTRS.Moveprevious
if OUTRS.BOF then
no_prev=true
else
no_prev=false
end if
OUTRS.movenext
end if
else
'得到当前记录
record=Request("List")
set OUTRS=server.CreateObject ("adodb.recordset")
STRSQL="select * from authors order by au_lname"
OUTRS.Open STRSQL,conn,1,1
OUTRS.Find "au_lname='" & au_lname & "'"
if OUTRS.EOF then
OUTRS.MoveFirst
no_prev=true
OUTRS.movenext
if OUTRS.eof then
no_next=true
end if
OUTRS.moveprevious
else
OUTRS.movenext
if OUTRS.eof then
no_next=true
end if
OUTRS.moveprevious
OUTRS.moveprevious
if OUTRS.bof then
no_prev=true
end if
OUTRS.movenext
end if
end if
%>
<table width="100%" border="1">
<tr>
<%
for each title in OUTRS.fields
%>
<td width="26%"><%=title.name%></td>
<%
next
%>
</tr>
<tr>
<%
if not(OUTRS.eof) then
for each FieldsValue in OUTRS.fields
%>
<td>
<%=FieldsValue.value%>
</td>
<%
next
else
Response.Write "<td>No Record</td>"
end if
%>
</tr>
</table>