| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 842 人关注过本帖
标题:[求助]不知道异常错误是什么啊??
取消只看楼主 加入收藏
十一文
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-4-27
结帖率:50%
收藏
 问题点数:0 回复次数:7 
[求助]不知道异常错误是什么啊??

不知道异常错误是什么啊??

我编了个ASP东西
在运行时停止了!
结果没有出错页面
但是在查看原代码时显示发生异常

异常是在一个打开数据库 RECORDSET 对象的地方
不知道为什么??

请高手指教,可能四什么原因!
顺便问一下最多可以打开多少次数据表,我怎么在一次运行是出现个不能在打开更多的表的错误啊??

搜索更多相关主题的帖子: 数据库 数据表 地方 
2006-08-19 20:49
十一文
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-4-27
收藏
得分:0 
<%dim fathercolumn,checkcolumnrights,tocolumnfather

fathercolumn=trim(session("userright"))
fathercolumn=mid(fathercolumn,len(fathercolumn)-2,2)
tocolumnfather=fathercolumn
fathercolumn=cint(fathercolumn)


sub checkcolumnright1(statecolumnid)

if fathercolumn<>statecolumnid then
set rscolumnfather=server.CreateObject("Adodb.Recordset")
sqlcolumnfather="SELECT ColumnFatherId,ColumnStage from inf_Column where ColumnId="&statecolumnid
rscolumnfather.open sqlcolumnfather,conn,1,3

statecolumnid=rscolumnfather("ColumnFatherId")
statecolumnid=trim(statecolumnid)
statecolumnid=left(statecolumnid,2)
statecolumnid=cint(statecolumnid)
if (statecolumnid<>fathercolumn and rscolumnfather("ColumnStage")=0) then
checkcolumnrights=false
rscolumnfather.close
set rscolumnfather=nothing
else
rscolumnfather.close
set rscolumnfather=nothing
call checkcolumnright1(statecolumnid)
end if
else
checkcolumnrights=true
end if

end sub

public function checkcolumnright(statecolumnid)
call checkcolumnright1(statecolumnid)
if checkcolumnrights then
checkcolumnright=true
else
checkcolumnright=false
end if

end function

public Arraycolumnlist()

function isColumnSon(columnid)
if len(columnid)=1 then
fathercolumnid="0"&cstr(columnid)
else
fathercolumnid=cstr(columnid)
end if

sqlGetColumnSonNum = "select count(ColumnId) from inf_Column where ColumnFatherId ='" & fathercolumnid&"'"
Set rsGetColumnSonNum =conn.Execute(sqlGetColumnSonNum)

if((Not rsGetColumnSonNum.Eof) And (Not rsGetColumnSonNum.Bof)) then
ColumnColumnNum = CInt(rsGetColumnSonNum(0))
rsGetColumnSonNum.close
set rsGetColumnSonNum =nothing
else
rsGetColumnSonNum.close
set rsGetColumnSonNum =nothing
conn.close
set conn=nothing
response.Redirect"admin_index.asp?errcode=4"
end if

if(ColumnColumnNum = 0) then
isColumnSon = 0
else
isColumnSon =1
end if

end function


sub checkarticleright(statearticleid)
if statearticleid<>"" then
set rsarticlecolumn=server.CreateObject("Adodb.Recordset")
sqlarticlecolumn="SELECT ColumnId from inf_Column where ColumnName in (SELECT ArticleColumnName from inf_Article where ArticleId="&statearticleid&")"
rsarticlecolumn.open sqlarticlecolumn,conn,1,3

if (not rsarticlecolumn.eof) then
if (not checkcolumnright(rsarticlecolumn("Columnid"))) then
rsarticlecolumn.close
set rsarticlecolumn=nothing
response.redirect"admin_index.asp?errcode=1"
end if
else
rsarticlecolumn.close
set rsarticlecolumn=nothing
response.redirect"admin_index.asp?errcode=1"
end if

else
response.Redirect"admin_index.asp?errcode=4"
end if

end sub


sub addsoncolumn(columnId,num)
set rsgetsoncolumn=Server.CreateObject("Adodb.Recordset")
sqlgetsoncolumn="SELECT ColumnName,ColumnId from inf_Column where ColumnId="&columnid
rsgetsoncolumn.open sqlgetsoncolumn,conn,1,3 '就是这一行出错的啊

if not rsgetsoncolumn.eof then
columnlistid=rsgetsoncolumn("ColumnId")
soncolumnname=rsgetsoncolumn("ColumnName")
rsgetsoncolumn.close
set rsgetsoncolumn=nothing

Arraycolumnlist(num)=Arraycolumnlist(num)&"->"&soncolumnname
if isColumnSon(columnlistid)=1 then
call addsoncolumn(columnlistid,num)
end if

else
rsgetsoncolumn.close
set rsgetsoncolumn=nothing
response.Redirect"admin_index.asp?errcode=3"
end if



end sub



sub getcolumnlist()
set rscolumnlist=Server.CreateObject("Adodb.Recordset")
sqlcolumnlist="select ColumnName,ColumnId from inf_Column where ColumnFatherId='"&tocolumnfather&"'"
rscolumnlist.open sqlcolumnlist,conn,1,3

if not rscolumnlist.eof then
topcolumnnum=rscolumnlist.Recordcount
redim Arraycolumnlist(topcolumnnum)
topcolumnid=rscolumnlist("ColumnId")
for num=0 to rscolumnlist.Recordcount-1
Arraycolumnlist(num)=rscolumnlist("ColumnName")
if isColumnSon(topcolumnid)=1 then
call addsoncolumn(topcolumnid,num)’在这里调用
end if

rscolumnlist.movenext
next
rscolumnlist.close
set rscolumnlist=nothing

else
rscolumnlist.close
set rscolumnlist=nothing
response.Redirect"admin_index.asp?errcode=3"
end if

end sub
%>

我的程序就是在调用getcolumnlist()
得到用户所拥有权限的栏目列表
并却只要能够添加文章的栏目(子栏目)[/color]

[此贴子已经被作者于2006-8-22 12:40:59编辑过]


2006-08-21 11:22
十一文
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-4-27
收藏
得分:0 

运行时


显示发生异常啊

[此贴子已经被作者于2006-8-21 21:40:23编辑过]


2006-08-21 21:39
十一文
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-4-27
收藏
得分:0 
怎么餓办

明天来看,希望有人给个解决的方法啊!

2006-08-21 22:24
十一文
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-4-27
收藏
得分:0 
<!--#include file="conn.asp"-->
<!--#include file="checkright.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body { margin-left: 0px;margin-top: 0px; background-color:#99FF66}
table {
padding: 2px;
font-style: normal;
color: #0000FF;
font-size: 14px;
font-weight: normal;
}
td { text-align: center;}
.tdleft {
text-align: left;
}
.tdright {
text-align: right;
}
-->
</style>
</head>
<%
dim columnright,statearticleid
columnright=session("userright")

if columnright="" then
response.Redirect"admin_index.asp?errcode=1"
else
usercolumnright=cint(right(trim(columnright),1))
end if

if usercolumnright<"2" then
response.Redirect"admin_index.asp?errcode=1"
end if

if request("articleid")<>"" then
articleid=clng(trim(request("articleid")))
statearticleid=articleid
else
columnid=""
end if

call checkarticleright(statearticleid)



sub articleadd()
response.Write"<tr><td><table>"
response.Write"<tr><td>文章添加</td></tr>"
response.Write"<form name='myform' method='post' action='admin_articleedit.asp?type=add'>"
response.Write"<tr><td>文章所属栏目</td><td><select name=articlecolumnname>"
call getcolumnlist()
for num=1 to ubound(Arraycolumnlist)
response.Write"<option value='"&Arraycolumnlist(num)&"'>"&Arraycolumnlist&"</option>"
next
response.Write"</selet></td></tr>"
response.Write"<tr><td>标题:</td><td><input type='text' name='articletitle'></td></tr>"
response.Write"<tr><td>作者:</td><td><input type='text' name='articleauthor'></td></tr>"
response.Write"<tr><td>关键字:</td><td><input type='text' name='articlekeyword'></td></tr>"
response.Write"<tr><td>摘要:</td><td></td><textarea name='articleabstruct' cols='14' rows='10'></textarea></tr>"
response.Write"<tr><td>内容:</td><td><textarea name='Content' style='display:none'></textarea><iframe ID='editor' src='editor.asp' frameborder=1 scrolling=no width='600' height='405'></iframe></td></tr>"
response.Write"<tr><td><input type='submit' value='提交'></td></tr>"
response.Write"</form></table></tr></td>"

end sub


sub articleaddtrue()
if request.Form("articletitle")<>"" then
articletitle=request.Form("articletitle")
articleauthor=request.Form("articleauthor")
articlekeyword=request.Form("articlekeyword")
articleadstruct=request.Form("articleadstruct")
articlecontent=request.Form("articlecontent")
articleaddername=session("user")
articleinputtime=now()
articlecolumnname=request.Form("articlecolumnname")

set rsarticleadd=Server.CreateObject("Adodb.Recordset")
sqlarticleadd="SELECT * from inf_article"
rsarticleadd.open sqlarticleadd,conn,1,3

rsarticleadd.addnew
rsarticleadd("ArticleTitle")= articletitle
rsarticleadd("ArticleAuthor")= articleauthor
rsarticleadd("ArticleKeyWord")= articlekeyword
rsarticleadd("ArticleAbstruct")= articleadstruct
rsarticleadd("ArticleContent")= articlecontent
rsarticleadd("ArticleAdderName")= articleaddername
rsarticleadd("ArticleInputTime")= articleinputtime
rsarticleadd("ArticleColumnName")= articlecolumnname
rsarticleadd.update

if err.number=0 then
response.Write"添加成功"
else
response.Redirect"admin_index.asp?errcode=3"
end if

end if
end sub


sub articledelete(articleid)
articleid=cint(articleid)
set rsdeletearticle=Server.CreateObject("Adodb.Recordset")
sqldeletearticle="SELECT * from inf_Article where ArticleId="&articleid
rsdeletearticle.open sqldeletearticle,conn,1,3
rsdeletearticle.delete
rsdeletearticle.update
rsdeletearticle.close
set rsdeletearticle=nothing
if err.number=0 then
response.Write"删除成功"
else
response.Redirect"admin_index.asp?errcode=3"
end if

end sub



sub articlemodify(articleid)
set rsmodifyarticle=Server.CreateObject("Adodb.Recordset")
sqlmodifyarticle="SELECT * from inf_Article where ArticleId="&articleid
rsmodifyarticle.open sqlmodifyarticle,conn,1,3

articletitle=rsmodifyarticle("ArticleTitle")
articleauthor=rsmodifyarticle("ArticleAuthor")
articlekeyword=rsmodifyarticle("ArticleKeyWord")
articleadstruct=rsmodifyarticle("ArticleAbstruct")
articlecontent=rsmodifyarticle("ArticleContent")
articlecolumnname=rsmodifyarticle("ArticleColumnName")

response.Write"<tr><td><table>"
response.Write"<tr><td>文章修改</td></tr>"
response.Write"<form name='myform' method='post' action='admin_articleedit.asp?type=add'>"
response.Write"<tr><td>文章所属栏目</td><td><select name='articlecolumnname'>"
call getcolumnlist() ‘调用函数处,得到栏目列表
for num=0 to ubound(Arraycolumnlist)-1
if instr(Arraycolumnlist(num),articlecolumnname,1)<>0 then
response.Write"<option value='"&Arraycolumnlist(num)&"' selected>"&Arraycolumnlist&"</option>"
else
response.Write"<option value='"&Arraycolumnlist(num)&"'>"&Arraycolumnlist&"</option>"
end if
next
response.Write"</selet></td></tr>"
response.Write"<tr><td>标题</td><td><input type='text' name='articletitle' value='"&articletitle&"'></td></tr>"
response.Write"<tr><td>作者</td><td><input type='text' name='articleauthor' value='"&articleauthor&"'></td></tr>"
response.Write"<tr><td>关键字</td><td><input type='text' name='articlekeyword' value='"&articlekeyword&"'></td></tr>"
response.Write"<tr><td>摘要</td><td></td><textarea name='articleabstruct' cols='14' rows='10'>"&articleadstruct&"</textarea></tr>"
response.Write"<tr><td>内容</td><td><textarea name='Content' style='display:none'>"&articlecontent&"</textarea><iframe ID='editor' src='editor.asp' frameborder=1 scrolling=no width='600' height='405'></iframe></td></tr>"
response.Write"<tr><td><input type='submit' value='提交'></td></tr>"
response.Write"</form></table></tr></td>"
end sub


sub articlemodifytrue()
if request.Form("articletitle")<>"" then
articletitle=request.Form("articletitle")
articleauthor=request.Form("articleauthor")
articlekeyword=request.Form("articlekeyword")
articleadstruct=request.Form("articleadstruct")
articlecontent=request.Form("articlecontent")
articlecolumnname=request.Form("articlecolumnname")

set rsarticlemodify=Server.CreateObject("Adodb.Recordset")
sqlarticlemodify="SELECT * from inf_article"
rsarticlemodify.open sqlarticleadd,conn,1,3

rsarticlemodify.addnew
rsarticlemodify("ArticleTitle")= articletitle
rsarticlemodify("ArticleAuthor")= articleauthor
rsarticlemodify("ArticleKeyWord")= articlekeyword
rsarticlemodify("ArticleAbstruct")= articleadstruct
rsarticlemodify("ArticleContent")= articlecontent
rsarticlemodify("ArticleColumnName")= articlecolumnname
rsarticlemodify.update

if err.number=0 then
response.Write"修改成功"
else
response.Redirect"admin_index.asp?errcode=3"
end if

end if
end sub

%>

<body>
<table width="779" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="779" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCFBAA">
<tr>
<td colspan="4" background="image/columtop.gif" align="left"><span style="font-weight:bolder;font-size:16px">文章管理</span></td>
</tr>
<tr>
<td><span style="font-weight:bolder">管理导航</span></td>
<td>修改文章</td>
<td>添加文章</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="779" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCFBAA">
<tr>
<td background="image/seccolume.gif">文章编辑</td>
</tr>


<%
if request("type")<>"" then
if request("type")="add" then
call articleadd()
else
call articleaddtrue()
end if


if request("type")="del" then
if request("articleid")<>"" then
call articledelete(articleid)
else
response.Redirect"admin_index.asp?errcode=4"
end if
end if

if request("type")="modify" then
if request("articleid")<>"" then
call articlemodify(articleid)
else
call articlemodifytrue()
end if
end if
else
response.Redirect"admin_index.asp?errcode=4"
end if


%>
<tr>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>

</body>
</html>



[此贴子已经被作者于2006-8-22 11:56:35编辑过]


2006-08-22 11:54
十一文
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-4-27
收藏
得分:0 
不是啊

调用处请看我的注试

[此贴子已经被作者于2006-8-22 12:41:54编辑过]


2006-08-22 12:39
十一文
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-4-27
收藏
得分:0 
怎么没人回了啊???
call addsoncolumn(topcolumnid,num)
这就是调用处啊

2006-08-22 19:26
十一文
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-4-27
收藏
得分:0 


怎么就不回了啊

2006-08-24 18:45
快速回复:[求助]不知道异常错误是什么啊??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035813 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved