%
dim id,sqlstr,rs,maxnum
id=Request("id")
if id="" or Not Isnumeric(id) then
Response.Redirect "index.asp?id=999"
else
id=clng(id)
end if
sqlstr="select max(id) from love"
call opendb()
set rs=server.createobject("adodb.recordset")
rs.open sqlstr,conn,1,1
maxnum=rs(0)
call closedb()
%>