[求助]请教一个split的问题

snower01 2004-03-31 11:07:26
这是我写的一段函数,取的是数据库中的一组数据作为数组。

<%
function fix_name()
set rs=server.createobject("adodb.recordset")
strsql="select fixname from fixture"
rs.open strsql,conn,1,1
fix_num=rs.recordcount
rs.movefirst
for i=1 to fix_num
fix_name1=rs("fixname")&"|"
rs.movenext
next
fix_name=fix_name1
rs.close
set rs=nothing
end function
%>

在另一个文件中我要将fix_name拆开,代码如下:

<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<%
set rs=server.createobject("adodb.recordset")
fix=split(fix_name(),"|")
fix_n=ubound(fix)
response.write fix_n
%>

为什么提示是:


Microsoft VBScript 运行时错误 错误 魸a01f5'

非法赋值: 'fix'


/kyz/s/lx.asp,行 5

谢谢!

...全文
78 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
snower01 2004-04-01
  • 打赏
  • 举报
回复
Microsoft VBScript 运行时错误 错误 '800a0009'

下标越界

/kyz/s/l.asp,行 19
即:response.write fix_name(i)&"<br>"
chendongqiang 2004-04-01
  • 打赏
  • 举报
回复
for i = 0 to UBound(fix_name,2)-1
response.write fix_name(i)&"<br>"
next
commaxsoft 2004-04-01
  • 打赏
  • 举报
回复
你能保证你那个函数里从数据库取数据一定行吗??

=====================================================
在线编辑WORD,EXCEL等OFFICE文档控件的ASP源代码下载地址:
http://www.superoa.net/webofficeforasp.rar
更详细信息访问:http://www.superoa.net
标准COM接口,支持开发语言:VB,VC,C#,ASP,ASP.NET,PHP,JSP,java等
QQ:53928716
snower01 2004-04-01
  • 打赏
  • 举报
回复
up
snower01 2004-04-01
  • 打赏
  • 举报
回复
顶一下
sfar 2004-04-01
  • 打赏
  • 举报
回复
for i=0 to fix-1
fix_n=ubound(fix , i )
next
snower01 2004-04-01
  • 打赏
  • 举报
回复
up
snower01 2004-04-01
  • 打赏
  • 举报
回复
up
Unending 2004-03-31
  • 打赏
  • 举报
回复
问题真正所在绝非是你的Split用的不好,而是把一个VBScript的保留函数Fix但变量使用
  • 打赏
  • 举报
回复
dim fix_name

set rs=server.createobject("adodb.recordset")
strsql="select fixname from fixture"
rs.open strsql,conn

if not rs.eof then
fix_name=rs.getrows()
end if

rs.close
set rs=nothing

-------------------------------------

for i = 0 to UBound(fix_name,2)
response.write fix_name(i)&"<br>"
next


  • 打赏
  • 举报
回复
感觉上你是没事找事,本来是个数组你要转换为字符串,然后又把字符串转换为数组。呵呵

snower01 2004-03-31
  • 打赏
  • 举报
回复
不行呀!
snower01 2004-03-31
  • 打赏
  • 举报
回复
试试
  • 打赏
  • 举报
回复
dim fix_name,fix_name1
rs.movefirst
for i=1 to fix_num
fix_name1=fix_name1&"|"&rs("fixname")
rs.movenext
next
fix_name=fix_name1

28,409

社区成员

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

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