asp不能实现排列按数学分数从高到低
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#INCLUDE FILE="odbc_connection.asp"--> <html> <head> <title>查询记录代码九: 从已有字段生成新的字段</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <h2 align="center">成绩表</h2> <center> <table border="0" width="90%"> <tr bgcolor="#B7B7B7" align="center"> <td width="15%"><a href="Sindex.asp?col=stu_code">学号</a></td> <td width="15%"><a href="Sindex.asp">姓名</a></td> <td width="15%"><a href="Sindex.asp?col=chinese">语文</a></td> <td width="15%"><a href="Sindex.asp?col=math">数学</a></td> <td width="15%"><a href="Sindex.asp?col=english">英语</a></td> <td width="15%"><a href="Sindex.asp?col=total">总分</a></td> </tr> <% '建立Recordset对象 Dim strSql,rs if col="" then col=stu_code response.Write"col" end if select case col case total strSql="Select stu_code,stu_name,chinese,math,english,(chinese+math+english) As total From grade" strSql=strSql & " Order By (chinese+math+english) Desc" Set rs=db.execute(strSql) case chinese strSql="Select stu_code,stu_name,chinese,math,english,(chinese+math+english) As total From grade" strSql=strSql & " Order By chinese Desc" Set rs=db.execute(strSql) case math strSql="Select stu_code,stu_name,chinese,math,english,(chinese+math+english) As total From grade" strSql=strSql & " Order By math Desc" Set rs=db.execute(strSql) case english strSql="Select stu_code,stu_name,chinese,math,english,(chinese+math+english) As total From grade" strSql=strSql & " Order By english Desc" Set rs=db.execute(strSql) case else strSql="Select stu_code,stu_name,chinese,math,english,(chinese+math+english) As total From grade" strSql=strSql & " Order By stu_code Desc" Set rs=db.execute(strSql) end select Do While Not rs.Eof %> <tr bgcolor="#F2F2F2" align="center"> <td><%=rs("stu_code")%></td> <td><%=rs("stu_name")%></td> <td><%=rs("chinese")%></td> <td><%=rs("math")%></td> <td><%=rs("english")%></td> <td><%=rs("total")%></td> </tr> <% rs.MoveNext Loop %> </table> </center> </body> </html>