白带能不能吃:错误:类型不匹配

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 12:24:55
这个页面是用来分页的,sm是用户输入的每页的数目
<%Dim Action,ErrCodes
Action=Request("action")
Select Case Action
Case "main"
Call main()

Case else
Call showlist()
End Select
If FoundErr=True then
Call ShowAdminErrMsg()
End If
%>
<%sub showlist()%>
<% openssgl()
dim sm
sm=trim(request.form("sm"))
PgSz=sm '设定开关,指定每一页所显示的帖子数目,默认为20帖一页
Set rs = Server.CreateObject("ADODB.Recordset")
sql="SELECT * FROM StudentInfo where 语文<60 "
rs.OPEN sql,Conn,1,1
If RS.RecordCount=0 then
response.write "<P><center>对不起,数据库中没有相关信息!</center></P>"
else
RS.PageSize = sm '设定PageSize属性的值 (发生错误的一行)

Total=INT(RS.recordcount / PgSz * -1)*-1 '计算可显示页面的总数

PageNo=Request("pageno")

if PageNo="" Then

PageNo = 1

else

PageNo=PageNo+1

PageNo=PageNo-1

end if

ScrollAction = Request("ScrollAction")

if ScrollAction = " 上一页 " Then

PageNo=PageNo-1

end if

if ScrollAction = " 下一页 " Then

PageNo=PageNo+1

end if

if PageNo <1 Then

PageNo = 1

end if

n=1

RS.AbsolutePage = PageNo

Response.Write "<CENTER>"

position=RS.PageSize*PageNo

pagebegin=position-RS.PageSize+1

if position <RS.RecordCount then

pagend=position

else

pagend= RS.RecordCount

end if

Response.Write "<P><font color='Navy'><B>数据库查询结果:</B>"

Response.Write "(共有"&RS.RecordCount &"条符合条件的信息, 显示"&pagebegin&"-"&pagend&")</font></p>"

Response.Write "<TABLE WIDTH=600 BORDER=1 CELLPADDING=4 CELLSPACING=0 BGCOLOR=#FFFFFF>"

Response.Write "<TR BGCOLOR=#5FB5E2><FONT SIZE=2><TD> <B>主题</B></TD><TD><B>用户</B></TD><TD><B>Email</B> </TD><TD><B>发布日期</B></TD></FONT><TR BGCOLOR=#FFFFFF>"

Do while not (RS is nothing)

RowCount = RS.PageSize

Do While Not RS.EOF and rowcount > 0

If n=1 then

Response.Write "<TR BGCOLOR=#FFFFFF>"

ELSE

Response.Write "<TR BGCOLOR=#EEEEEE>"

End If

n=1-n %>

<TD><span style="font-size:9pt">

<A href='view.asp?key=<% =RS("stu_id")%>'><% =RS("stu_name")%>

</A></span></td>

<TD><span style="font-size:9pt">

<% =RS("stu_name")%></A></span></td>

<TD><span style="font-size:9pt">

<a href="mailto:<% =RS("xb")%>"><% =RS("xb")%></a>

</span> </TD>

<TD><span style="font-size:9pt">

<% =RS("zy")%></span> </td>

</TR>

<%

RowCount = RowCount - 1

RS.MoveNext

Loop

set RS = RS.NextRecordSet

Loop

Conn.Close

set rs = nothing

set Conn = nothing

%>

</TABLE>

<FORM METHOD=GET ACTION="?action=showlist">

<INPUT TYPE="HIDDEN" NAME="pageno" VALUE="<% =PageNo %>">

<%

if PageNo > 1 Then

response.write "<INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE=' 上一页 '>"

end if

if RowCount = 0 and PageNo <>Total then

response.write "<INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE=' 下一页 '>"

end if

response.write "</FORM>"

End if

%>

sm=trim(request.form("sm"))
....
RS.PageSize = sm '设定PageSize属性的值 (发生错误的一行)

记录集rs的PageSize 属性返回 Long 值,指示一页上的记录数目。默认值为 10。trim(request.form("sm")) 返回的是字符串类型,你需要转化一下类型才能赋给RS.PageSize,应该这样写:

RS.PageSize = Clng(sm)