主题:  急啊,我的数据库什么时候关闭了呢?

chenzhenjiang

职务:普通成员
等级:1
金币:0.0
发贴:1
注册:2006/2/15 10:57:44
#12006/2/15 11:05:59
我看到网上有好多介绍如何解决数据库的问题但是均不适用,因此请大家帮助.我的一个asp网页内容是:

<!--#include file="../inc/dbconn.inc"-->
<%
if session("username"="" then
response.write "<p align='center'><font size='2'> 您没有登陆,访问无效!</font></p>"
response.write "<p align='center'><a href='../login.asp' target='_self'><font size='2'>返回</font></a></p>"
response.end
end if
%>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../style.css">
<body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 leftmargin=0>
<script language="javascript">
function show_set(mylink)
{
window.open(mylink,'new','top=110,left=280,width=240,height=60,scrollbars=no')
}
</script>
<%
DIM totalPut
DIM CurrentPage
DIM TotalPages
DIM i,j
const MaxPerPage=8
if not isempty(request("page") then
currentPage=cint(request("page")
else
currentPage=1
end if
if not isempty(request("selAnnounce") then
idlist=request("selAnnounce"
if instr(idlist,",">0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
dim rs
dim sql
if not isempty(request("subject") then
search=request("subject"
end if
if not request("txtitle"="" then
tmpsql="where user like '%"&request("txtitle"&"%' and"
else
tmpsql="where"
end if
if search=0 then
sql="select user_info.userid,user_info.user,user_info.pwd,user_info.bumen,user_info.regdate,bumen.bumen from user_info,bumen "&tmpsql&" uflag=0 and levell=5 and user_info.bumen=bumen.id order by user_info.userid desc"
else
sql="select user_info.userid,user_info.user,user_info.pwd,user_info.bumen,user_info.regdate,bumen.bumen from user_info,bumen "&tmpsql&" uflag=0 and levell=5 and user_info.bumen=bumen.id and bumen.id="&search&" order by user_info.userid desc"
end if
set rs=getrs(sql)
'response.write sql
if rs.eof and rs.bof then
response.write "<br><p align='center'>对不起,没有您要查询的信息</p>"
else
         totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
     if (totalPut mod MaxPerPage)=0 then
     currentpage= totalPut \ MaxPerPage
     else
     currentpage= totalPut \ MaxPerPage + 1
     end if
end if
if currentPage=1 then
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,""
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,""
else
currentPage=1
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,""
end if
end if
rs.close
end if
set rs=nothing
sub showContent (totalput,MaxPerPage)
%>
<CENTER>
<TABLE border=0 cellPadding=3 cellSpacing=1 width="100%">
<TBODY>
<Form name="search" method="POST" action="">
<TR>
<TD width="124" height=30> <font color="#ff0000">点击用户名称操作</font> </td>
<TD width="6">
<td width="28"><IMG border=0 src="../images/Search.gif"></td>
<td width="413">&nbsp;搜索关键字:<input type="text" name="txtitle" size="25" style="font-size: 9pt">&nbsp;&nbsp;
<select name="subject">
<option value="0">请选择部门</option>"
<%
        sqltxt="select * from bumen"
        set rs2=getrs(sqltxt)
        do while not rs2.eof
        if rs2("id"=cint(request("subject") then
        response.write "<option value='"&rs2("id"&"' selected>"&rs2("bumen"&"</option>"
        else
        response.write "<option value='"&rs2("id"&"'>"&rs2("bumen"&"</option>"
        end if
        rs2.movenext
        loop
        rs2.close
        %>
</select> <INPUT align=absMiddle border=0 src="../images/search1.gif" type=image>
</td>
</TR>
</FORM>
</TBODY>
</TABLE><BR>
<CENTER>
<Form name="searchuser" method="POST" action="">
<TABLE border="0" cellspacing="1" width="100%" cellpadding="4">
<TBODY>
<TR height=25 bgcolor="#e8f4ff">
<TD width="49" align="left"><b>ID号</b></TD>
<TD width="153" align="center"><b>用户名</b></TD>
<TD width="161" align="center"><b>密码</b></TD>
     <TD width="71" align="center"><b>所属部门</b></TD>
<TD width="150" align="center"><strong>注册日期</strong></TD>
<TD width="71" align="center"><b>审核</b></TD>
<TD width="67" align="center"><input type='submit' value='删除'></TD>
</TR>
<%
    do while not rs.eof
    
    %>
<TR height="20" bgcolor="#ffffff">
<TD width="49" align="left"><font face="Arial"><b><%=rs("userid"%></b></font></td>
<TD width="153"><a href=detail.asp?id=<%=rs("userid"%>><%=rs("user"%></a></td>
<TD width="161"><%=rs("pwd"%></td>
     <TD width="150"><%=rs("bumen"%></td>
<TD width="150"><%=rs("regdate"%></td>
<TD width="71" align="center"><a href='javascript:show_set(&quot;attribute.asp?id=<%=rs("userid"%>&quot'><img border="0" alt="" src="../images/m_news.gif"></a></td>
<TD width="67" align="center"><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("userid")%>'></td>
</TR>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</TABLE>
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
if CurrentPage<2 then
response.write "<table border=0 width=600 cellspacing=0 cellpadding=0 bgcolor=#e8f4ff>"
response.write "<tr height=30>"
response.write "<td bgcolor=#e8f4ff>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条信息</td>"
response.write "<td align=right>"
response.write "【最前页】【上一页】"
else
response.write "<table border=0 width=600 cellspacing=0 cellpadding=0 bgcolor=#e8f4ff>"
response.write "<tr height=30>"
response.write "<td bgcolor=#e8f4ff>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条信息</td>"
response.write "<td align=right>"
response.write "【<a href="&filename&"?page=1&search="&tyeid&"&txtitle="&request("txtitle"&">最前页</a>】"
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&search="&search&"&txtitle="&request("txtitle"&">上一页</a>】"
end if
if n-currentpage<1 then
response.write "【下一页】【最后页】"
else
response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&search="&search&"&txtitle="&request("txtitle"&">"
response.write "下一页</a>】【<a href="&filename&"?page="&n&"&search="&search&"&txtitle="&request("txtitle"&">最后页</a>】"
end if
response.write "</td>"
response.write "</tr>"
response.write "</table>"
response.write "</form>"
end function
sub deleteannounce(id)
dim sql
sql="delete from [user_info] where userid="&cstr(id)
conn1.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub
%>



运行后提示为:
ADODB.Recordset 错误 '800a0e78'

对象关闭时,不允许操作。

/admin/user/dshy.asp,行 60

网上提示说是有close,但是我运用这个方法没有解决.