不要用SID来排序,用ID来做即可!
1.asp代码如下:
<%Dim conn,rs
Dim connstr
Dim sqlCmd
'创建数据库连接对象并打开
set conn=server.createobject("adodb.connection")
connstr="Provider=Microsoft.jet.oledb.4.0;data source=" & server.mappath("x.mdb")
conn.open connstr%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<%
Dim sql
set rs=server.createobject("adodb.recordset")
sql="select * from 留言内容 order by id"
rs.open sql,conn,1,1
if rs.eof and rs.bof Then
end If
do while not rs.eof
Response.Write ""&rs("id")&" "&rs("名字")&""
If(rs("id")<>1) Then
Response.Write " <a href='2.asp?action=up&orderid="&rs("sid")&"'>上移</a>"
Else
Response.Write " "
End if
If(rs("id")<rs.recordcount) Then
Response.Write " <a href='2.asp?action=down&orderid="&rs("sid")&"'>下移</a>"
Else
Response.Write " "
End if
Response.Write"<br>"
rs.movenext
Loop
rs.close
set rs=Nothing%>
</body>
</html>