CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

递归执行出错

楼主dengfvip(丘吉归来)2006-02-20 19:03:53 在 Web 开发 / ASP 提问

我写了一个递归函数取部门名称:  
   
  function   crtdep(fdep)  
          set   frs=Server.CreateObject("ADODB.Recordset")  
          fsql="select   deptcde,deptname,parentdep   from   t_com_deptment   where   parentdep='"&fdep&"'"  
  frs.open   fsql,conn,1,1  
  do   while   not   frs.eof  
          response.write   "  "&frs("deptname")  
                            crtdep   frs("deptcde")  
          frs.movenext  
  loop  
  frs.close  
  set   frs=nothing  
   
  end   function  
   
  crtdep("2")  
   
  但是执行出错:  
  ---------------------------------------------------  
  Microsoft   VBScript   运行时错误   错误   '800a01fb'    
   
  出现一个意外错误:   'frs.Open'    
   
  /apps/sysmgr/deptment/deeptree.asp,行34    
  问题点数:20、回复次数:3Top

1 楼hj3793(白开心)回复于 2006-02-20 20:45:55 得分 20

'数据库打开没有关闭  
  -----------------------------  
  Dim   myArray(0)  
  Dim   iMax  
  Dim   iRecordCount  
  function   crtdep(fdep)  
          set   frs=Server.CreateObject("ADODB.Recordset")  
          fsql="select   deptcde,deptname,parentdep   from   t_com_deptment   where   parentdep='"&fdep&"'"  
  frs.open   fsql,conn,1,1  
                    iMax   =   Ubound(myArray)  
                    iRecordCount   =   frs.RecordCount  
                    ReDim   myArray(iMax   +   iRecordCount)  
  do   while   not   frs.eof  
                            myArray(iMax   +   1)   =   frs("deptname")  
                            frs.movenext  
  loop  
  frs.close  
  set   frs=nothing  
                     
                    For   i   =   iMax   +   1   to   iMax+iRecordCount  
                                crtdep   myArray(i)  
                    Next  
  end   functionTop

2 楼dengfvip(丘吉归来)回复于 2006-02-21 09:06:09 得分 0

不知道怎么回事,同样的代码我在另外一台电脑上又可以正常运行?  
  搞不懂了!Top

3 楼dengfvip(丘吉归来)回复于 2006-02-21 09:45:41 得分 0

原因找到,是数据有问题,陷入死循环Top

相关问题

  • 递归函数执行ADOQuery可以吗?
  • 递归显示文件路径代码在JSP里面出错
  • 执行DBGridEh1.Columns.Add 出错
  • 请大家帮忙看一下这个栏目递归那里出错了(C#)
  • ASP中递归查询Access可以执行到多少层?
  • 执行query.open后出错
  • aspx文件执行出错
  • update语句执行出错!!
  • hibernate执行hql出错
  • 递归……

关键词

  • fdep
  • fsql
  • parentdep
  • crtdep
  • deptcde
  • deptment
  • fr
  • deptname
  • myarray
  • open

得分解答快速导航

  • 帖主:dengfvip
  • hj3793

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo