ASP模块出现运行错误,帮忙查找原因

@肖凌 2009-09-07 07:24:53
错误类型:
Microsoft VBScript 运行时错误 (0x800A005E),请帮忙找出原因和解决方法.............
无效使用 Null
/网络考试系统/Manage/admin/adm_Admin.asp, 第 111 行

/////////////////////adm_Admin.asp代码如下///////////////
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../Conn/conn.asp"-->
<%
getcondition = replace(trim(request("condition")),"'","''")
getkey = replace(trim(request("key")),"'","''")

if(getcondition = "" or getkey = "")then
rssql = "select * from tb_Administrator order by JoinTime Desc"
else
if(InStr(getcondition,"JoinTime") > 0)Then
If(InStr(getkey,"-") > 0)Then
darray = Split(getkey,"-")
getkey = ""
For a=0 To Ubound(darray)
If(len(darray(a)) = 1 )Then
darray(a) = "0"&darray(a)
End If
getkey = getkey&darray(a)&"-"
Next
getkey = Mid(getkey,1,len(getkey)-1)
End If
rssql = "select * from tb_Administrator where convert(varchar(10),"&getcondition&",121) like '%"&getkey&"%' order by JoinTime Desc"
Else
rssql = "select * from tb_Administrator where "&getcondition&" like '%"&getkey&"%' order by JoinTime desc"
End If
end if
set rs = server.createobject("adodb.recordset")
rs.open rssql,conn,1,3
rs.pagesize = 5
'实现分页
if rs.eof then
rs_total = 0
else
rs_total = rs.recordcount
end if

dim pageno
getpageno = replace(trim(request("pageno")),"'","")
if(getpageno = "")then
pageno = 1
else
pageno = getpageno
End if
if(not rs.eof)then
rs.absolutepage = pageno
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理员信息</title>
<link href="../../Css/style.css" rel="stylesheet">
<script language="javascript" src="js/js.js"></script>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body topmargin="0" leftmargin="0">

<form name="queryadmin" method="post" action="adm_Admin.asp">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr align="left" bgcolor="#5D5D5D">
<td height="27" colspan=6><span class="style1"><strong>>></strong> <strong>当前位置:管理员信息管理</strong> </span></td>
</tr>
<tr>
<td width="28%" height="26" align=right nowrap style="color:black;">查询条件:</td>
<td width="17%">
<select name="condition" class="wenbenkuang" style="width:150;border:1px solid;">
<option value="Name" <%If(InStr(getcondition,"Name") > 0)Then%>selected<%End If%>>管理员名称</option>
<option value="JoinTime" <%If(InStr(getcondition,"JoinTime") > 0)Then%>selected<%End If%>>加入时间</option>
</select>
</td>
<td width="9%" align = right nowrap style="color:black;">关键字:</td>
<td width="19%">
<input name="key" type="text" class="txt_grey" value="<%=Server.HTMLEncode(Replace(getkey,"''","'"))%>">
</td>
<td width="9%"><input name="submit" type="submit" class="btn_grey" style="border:1px solid;" value="查询"></td>
<td width="18%" align="center" nowrap> </td>
</tr>
</table>
</form>
<form name="deladmin" method="post">
<table width="98%" border="1" cellspacing="0" cellpadding="0" align="center"
bordercolor="#FFFFFF" bordercolordark="#1985DB" bordercolorlight="#FFFFFF">
<tr>
<td width="5%" height="27" align="center" nowrap style="color:black;">选 项</td>
<td width="28%" height="27" align="center" nowrap style="color:black;">管 理 员 名 称</td>
<td width="25%" height="27" align="center" nowrap style="color:black;">管 理 员 密 码</td>
<td width="32%" height="27" align="center" nowrap style="color:black;">加 入 时 间</td>
<td width="10%" height="27" align="center" nowrap style="color:black;">修 改</td>

</tr>
<%
if(rs.eof)then
%>
<tr><td height="27" colspan=7 align=center nowrap><font color="red">没有符合条件的记录!</font></td></tr>
<%
else
repeat_rows = 0
while(repeat_rows < rs.pagesize) and (not rs.eof)
%>
<tr>
<td height="27" align=center nowrap>
<input type="checkbox" name="ChkBox" value="<%=server.htmlencode(rs("ID"))%>" style="border:0;">
</td>
<td height="27" align=center nowrap style="color:black;"><%=server.htmlencode(rs("Name"))%></td>
<td height="27" align=center nowrap style="color:black;"><%=server.htmlencode(rs("PWD"))%></td>
<td height="27" align=center nowrap style="color:black;">
<%=Mid(rs("JoinTime"),1,InStr(rs("JoinTime")," "))%>
</td>
<td height="27" align=center nowrap style="color:black;">
[<a href="adm_UpdateAdmin.asp?id=<%=rs("ID")%>&condition=<%=getcondition%>&key=<%=getkey%>&pageno=<%=pageno%>" target="mainr">修 改</a>]
</td>
</tr>
<%
repeat_rows = repeat_rows + 1
rs.movenext
wend
%>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td colspan=5> </td>
</tr>
<tr>
<td width="3%" height="26" align=right nowrap><input name="Chkall" type="checkbox" style="border:0;" onClick="CheckAll(this.form.ChkBox,this.form.Chkall)">
</td>
<td width="7%" align=center nowrap style="color:black;">[全选/反选]</td>
<td width="30%" nowrap>[<a style="cursor:hand;color:red;" onclick="javascript:Check(deladmin)">删除</a>]
[<a href="adm_AddAdmin.asp" target="mainr"><font color="red">添加管理员</font></a>]
<input type="hidden" name="condition" value="<%=getcondition%>">
<input type="hidden" name="key" value="<%=getkey%>">
<input type="hidden" name="pageno" value="<%=getpageno%>"></td>
<td width="2%"></td>
<td width="58%">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td align=right nowrap style="color:black;">
[<%=pageno%>/<%=rs.pagecount%>] [共<font color="red"><%=rs_total%></font>条记录] 
<%
if(pageno <> 1)then
%>
<a href="?condition=<%=getcondition%>&key=<%=getkey%>">第一页</a>
<%
End if
%>
<%
if(pageno <> 1)then
%>
 <a href="?condition=<%=getcondition%>&key=<%=getkey%>&pageno=<%=(pageno-1)%>">上一页</a> 
<%
end if
%>
<%
if(instr(pageno,cstr(rs.pagecount)) = 0)then
%>
<a href="?condition=<%=getcondition%>&key=<%=getkey%>&pageno=<%=(pageno+1)%>">下一页</a>
<%
end if
%>
<%
if(instr(pageno,cstr(rs.pagecount)) = 0)then
%>
 <a href="?condition=<%=getcondition%>&key=<%=getkey%>&pageno=<%=rs.pagecount%>">最后一页</a>
<%
end if
rs.close
set rs = nothing
%></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<%
end if
%>
</body>
</html>
...全文
72 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangchaokun 2009-09-07
  • 打赏
  • 举报
回复
除了Instr的原因外,也有可能问题出现在rs("JoinTime"),是不是保证每个JoinTime字段数据都存在,而不为NULL呢
来还债 2009-09-07
  • 打赏
  • 举报
回复
InStr 函数
返回某字符串在另一字符串中第一次出现的位置。

InStr([start, ]string1, string2[, compare])

参数
start

可选项。数值表达式,用于设置每次搜索的开始位置。如果省略,将从第一个字符的位置开始搜索。如果 start 包含 Null,则会出现错误。如果已指定 compare,则必须要有 start 参数。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧