请各位帮帮忙?
请各位帮个忙~~我是刚学ASP的,在下面的实现分页的代码中,老出现这个错误:Microsoft VBScript 运行时错误 '800a000d'
类型不匹配: '[string:ID "
"]'
\fenye.asp, line 63
原代码是:
<%
dim Conn, rs
set conn=server.createobject("ADODB.CONNECTION")
conn.open "DBQ="+server.mappath("web.mdb")+";DRIVER=
{Microsoft Access Driver (*.mdb)};"
Set rs = Server.CreateObject("ADODB.Recordset")
Key = Request("Key")
Sort = Request("Sort")
Page = Clng(Request("Page"))
sql = "Select * from xinxi"
If Key > "" Then sql = sql + " order by " & Key
If Sort > "" Then sql = sql & " " & Sort
rs.open sql, conn, 3, 2
rs.PageSize = 4 '每页显示记录数
If Page < 1 then Page = 1
If page > rs.PageCount Then Page = rs.PageCount
If rs.PageCount > 0 then rs.AbsolutePage = Page
MySelf = Request.ServerVariables("PATH_INFO")
%>
<html>
<body>
<center>
<p>
<font face="Arial" size=5>SQL Server<br>
Northwind Database MultiPage Control Demo</font>
</p>
<form action="fenye.asp" method="post">
排序字段:
<select name="Key">
<option value="ID" <% If Key="ID" Then Response.Write
"selected" %>>ID</option>
<option value="userName" <% If Key="userName" Then
Response.Write "selected" %>>userName</option>
</select>
输出顺序:
<select name="Sort">
<option value="ASC" <% If Sort="ASC" Then Response.Write
"selected" %>>递增</option>
<option value="DESC" <% If Sort="DESC" Then Response.Write
"selected" %>>递减</option>
</select>
<input type="submit" name="ok" value="确认">
</form>
</center>
<center>
<p>
<font face="Arial" size=5>SQL Server<br>
Northwind Database MultiPage Control Demo</font>
</p>
<table border=0 cellpadding=0 cellspacing=1 width=96%>
<%
Response.Write("<TR BGCOLOR=#ccccd7>")
Response.Write("<TD>ID</TD>")
Response.Write("<TD>username</TD>")
Response.Write("<TD>title</TD>")
Response.Write("<TD>text</TD>")
Response.Write("<TD>createdate</TD>")
Response.Write("</TR>")
For i = 1 to rs.PageSize
If rs.EOF Then Exit For
If i mod 2=0 Then
Color = "#ddddd7"
Else
Color = "#eeeeef"
End If
Response.Write("<TR BGCOLOR=" + Color + ">")
Response.Write("<TD>"+rs("ID")+"</TD>")
Response.Write("<TD>"+rs("username")+"</TD>")
Response.Write("<TD>"+rs("title")+"</TD>")
Response.Write("<TD>"+rs("text")+"</TD>")
Response.Write("<TD>"+rs("createdate")+"</TD>")
Response.Write("</TR>")
rs.MoveNext
Next
%>
</table>
</center>
<%
If rs.PageCount > 1 then
%>
<br>
<div align="center">
<a href="<%=MySelf%>?Page=<% =(Page - 1) %>&Sort=<%=Sort%
>&Key=<%=Key%>">上一页</a>??
<%
For i = 1 to rs.PageCount
If i = Page then
color = "Red"
response.write " <Font color=" + color + ">" + Cstr(i)
+ "</Font>? "
Else
color = "Black"
response.write " <a href=" + MySelf + "?Page=" + Cstr
((i)) + "&Sort=" + Sort +"&Key="+Key+"><Font color=" + color +
">" + Cstr(i) + "</Font></a>? "
End If
Next
%>??
<a href="<%=MySelf%>?Page=<%=(Page + 1)%>&Sort=<%=Sort%
>&Key=<%=Key%>">下一页</a>
</div>
<%
ElseIf rs.PageCount < 1 then
response.Write "<div align='center'><font color=red>无相关数
据!!...</font></div>"
End If
%>
</body>
</html>
请大家帮个看看是哪里出错~~~我急要用~~~我先谢谢大家~~~~~~~~~
[[it] 本帖最后由 星梦玲 于 2008-5-18 21:12 编辑 [/it]]