跪求!ASP中的split出错?能帮忙解决的话,加分!

来源:百度知道 编辑:UC知道 时间:2024/06/26 06:24:51
<%if isnull(lguserid) or lguserid="" then%>
……
<%
else
dim usern,userinfo
set rs=conn.execute("select * from [member] where name='"&lgname&"'")
%>
……
<%set usern=conn.execute("select top 1 userinfo from [member] where yd_id="&lguserid&"")
userinfo=usern("userinfo")
userinfo=split(userinfo,"|")
%>

我在整个网站中改了个参数:userid——yd_id
结果,有好多网页出错,提示:
错误类型:
Microsoft VBScript 运行时错误 (0x800A005E)
无效使用 Null: 'split'
求救,我看了好久,怎么改动都不行,谁能帮帮我呀!
能帮我解决的话,我再加分!跪求你了!
注:数据库没没问题。在没改参数前代码是没问题的,只是改参数就出错!
在线等待你的回复!!!!!!!!!!

首先这是获取userinfo的记录,然后再使用split函数进行分离。

为什么会出错呢?主要的原因是userinfo没有值的时候,就没办法使用split了。所以,需要加个判断:
if not(usern.eof or usern.bof) then
userinfo=usern("userinfo")
userinfo=split(userinfo,"|")
end if