首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

请哪位大侠帮哈忙 (0x80004005)无法从指定的数据表中删除。该怎么解决

2012-02-12 
请哪位大侠帮哈忙(0x80004005)无法从指定的数据表中删除。错误类型:MicrosoftJETDatabaseEngine(0x80004005

请哪位大侠帮哈忙 (0x80004005)无法从指定的数据表中删除。
错误类型:
Microsoft   JET   Database   Engine   (0x80004005)
无法从指定的数据表中删除。
/sanatorium/connection.asp,   第   60   行


浏览器类型:
Mozilla/4.0   (compatible;   MSIE   6.0;   Windows   NT   5.1;   SV1;   .NET   CLR   2.0.50727)  

网页:
GET   /sanatorium/admin/VIPadmin.asp  
     
VIPadmin.asp     代码
<%@LANGUAGE= "VBSCRIPT "   CODEPAGE= "936 "%>
<!--   #Include   File=../public.asp   -->
<%verifysession1()%>
<!--   #Include   File=../connection.asp   -->
<%
if   request( "id ") <> " "   then  
deleters   "users ", "ID ",replace(request( "id "), ",   ", "   or   ID= ") '删除数据
end   if
%>
<%selectrs   " ", "users ", "userrealname ", " ' "&request( "userrealname ")& " ' ",15%>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
<link   href= "css/css.css "   rel= "stylesheet "   type= "text/css ">
<style   type= "text/css ">
<!--
a:link   {
text-decoration:   none;
}
a:visited   {
text-decoration:   none;
}
a:hover   {
text-decoration:   none;
}
a:active   {
text-decoration:   none;
}
-->
</style> </head>
<body>
<table   width= "600 "     border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
    <tr>
        <td   height= "20 "> &nbsp; </td>
    </tr>
    <tr>
        <td> <table   width= "98% "     border= "1 "   align= "right "   cellpadding= "0 "   cellspacing= "1 "   bordercolor= "#CCCCCC "   bgcolor= "#000000 "   style= "   border-collapse:collapse ">
            <tr>
                <td   height= "10 "   bgcolor= "#666666 "   class= "style2 "> &nbsp;&nbsp;会员资料 </td>
            </tr>
        </table> </td>
    </tr>
    <tr>
        <td   height= "40 "> <table   width= "98% "     border= "1 "   align= "right "   cellpadding= "0 "   cellspacing= "1 "   bordercolor= "#000000 "   bgcolor= "#FFFFFF "   class= "style1 "style= "   border-collapse:collapse ">
            <tr   bgcolor= "#CCCCCC ">
                <td   width= "11% "   align= "center "> <label> 按姓名检索 </label> </td>
                <td   width= "13% "   align= "center "> <input   name= "userrealname "   type= "text "   id= "userrealname "   size= "10 "> </td>


                <td   width= "15% "   align= "center "> <input   name= "Submit "   type= "button "   class= "button "   value= "检索 "> </td>
                <td   width= "23% "   align= "center "> <a   href= "?pageno=1 <%=findtype%> "> <img   src= "images/new_09.gif "   width= "22 "   height= "8 "   border= "0 "> </a> &nbsp;&nbsp; <a   href= "?pageno= <%=pageno-1%> <%=findtype%> "> <img   src= "images/new_11.gif "   width= "23 "   height= "8 "   border= "0 "/> </a> &nbsp;&nbsp; <a   href= "?pageno= <%=pageno+1%> <%=findtype%> "> <img   src= "images/new_13.gif "   width= "23 "   height= "8 "   border= "0 "> </a> &nbsp;&nbsp; <a   href= "?pageno= <%=rs.pagecount%> <%=findtype%> "> <img   src= "images/new_15.gif "   width= "23 "   height= "8 "   border= "0 "> </a> </td>
                <td   width= "12% "> <select   name= "menu1 "   onChange= "javascript:window.location=this.value ">
                    <option> 转到 </option>
                    <%   for   i=1   to   rs.pagecount%>
                    <option   value= "?pageno= <%=i%> <%=findtype%> "> <%=i%> </option>
                    <%next%>
                </select> </td>
                <td   width= "18% "   align= "center "> 当前第 <%=pageno%> / <%=rs.pagecount%> 页 </td>
                <td   width= "8% "   align= "center "> 共 <%=rs.recordcount%> 条 </td>
            </tr>
        </table> </td>
    </tr>
    <tr>
        <td   height= "100 "> <table   width= "98% "     border= "1 "   align= "right "   cellpadding= "0 "   cellspacing= "1 "   bordercolor= "#000000 "   bgcolor= "#FFFFFF "style= "   border-collapse:collapse ">
            <tr   align= "center "   class= "style2 ">
                <td   width= "16% "   height= "20 "   bgcolor= "#666666 "> 姓名 </td>
                <td   width= "26% "   height= "20 "   bgcolor= "#666666 "> 用户名 </td>
                <td   width= "18% "   bgcolor= "#666666 "> 性别 </td>


                <td   width= "24% "   height= "20 "   bgcolor= "#666666 "> 电子邮件 </td>
                <td   width= "16% "   height= "20 "   bgcolor= "#666666 "> 手机 </td>
                <td   width= "16% "   bgcolor= "#666666 "> 操作 </td>

            </tr>
            <%   if   not   rs.eof   then   %>
    <%   for   i=1   to   rs.pagesize   %>
            <%   if   rs.eof   then   exit   for   %>
            <tr   align= "center "   bgcolor= "#CCCCCC "   class= "style1 "   onMouseOver= "this.style.backgroundColor= '#E2DFD6 ' "   onMouseOut= "this.style.backgroundColor= '#CCCCCC ' ">
                <td   height= "20 "   align= "left "   > &nbsp; <a   href= "#ok "   class= "style1 "   style= "color:000000 "onClick= "window.open( 'showuser.asp?id= <%=rs( "ID ")%> ', '_blank ', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=600,height=300,top=200,left=200 '); "> <%=rs( "userrealname ")%> </a> </td>
                <td   height= "20 "   align= "center "   > <%=rs( "users ")%> </td>
                <td   height= "20 "   align= "center "   > <%=rs( "sex ")%> </td>
                <td   height= "20 "   align= "center "   > <%=rs( "email ")%> </td>
                <td   height= "20 "   align= "center "   > <%=rs( "mobtel ")%> </td>
<td   align= "center "   > <input   name= "Submit2 "   type= "button "   class= "button "   value= "删除 "onClick= "javascript:if(confirm( '确定要删除吗? ')){window.location= 'VIPadmin.asp?id= <%=rs( "ID ")%> '} "> </td>
            </tr>
            <%  
      rs.movenext
      next
      else   response.Write( " <tr> <td   colspan= '5 '> 暂无记录 </td> </tr> ")
      end   if
    closers()
    closeconn()
    %>
        </table> </td>
    </tr>
</table>
</body>
</html>


connection.asp     代码


<%
'rsnum返回条数,rstable查寻表,rscondition查寻条件,rsattribute条件属性,rsfield字段名,rsfieldvalue字段值,rspagesize分页数

dim   pageno,findtype '公用变量

'////////////////////////////////////////////////////////打开数据库


set   conn=server.CreateObject( "adodb.connection ")
conn.open   "Provider   =   Microsoft.Jet.OLEDB.4.0   ;   Data   Source   =   "&   Server.MapPath   ( "../database/sanatorium.tomcatmdb ")
set   rs=server.CreateObject( "adodb.recordset ")
'////////////////////////////////////////////////////////查寻数据
function   selectrs(rsnum,rstable,rscondition,rsattribute,rspagesize)
if   rsnum <> " "   then   rsnum= "top   "&rsnum
if   rsattribute <> " ' ' "   then   allcondition= "   where   "&rscondition& "= "&rsattribute
if   request( "smalltype ") <> " "   then   allcondition= "   where   imagesmalltype= ' "&request( "smalltype ")& " ' "
exec= "select   "&rsnum& "   *   from   "&rstable&allcondition& "   order   by   ID   desc " 'ASC是升序
'response.write(exec)
rs.open   exec,conn,1,1
' <!--分页代码-->
if   request( "pageno ") <> " "   then
      pageno=clng(request( "pageno "))
      if     pageno=0   then
      pageno=1
      end   if
else
pageno   =1
end   if
if   rspagesize= " "   then   rs.pagesize=15   else   rs.pagesize=clng(rspagesize)
if   not   rs.eof   then
    if   pageno   <=   rs.pagecount   then   rs.absolutepage=pageno
    if   pageno   >   rs.pagecount   then   rs.absolutepage=rs.pagecount
end   if    
findtype= "&type= "&request( "type ")
if   request( "smalltype ") <> " "   then   findtype= "&smalltype= "&request( "smalltype ")
' <!--分页代码-->
end   function
'////////////////////////////////////////////////////////添加数据
function   addrs(rstable,rsfield,rsfieldvalue)
exec= "insert   into   "&rstable& "( "&rsfield& ")values( "&rsfieldvalue& ") "
'response.write(exec)
conn.execute   exec
end   function
'////////////////////////////////////////////////////////修改数据
function   modifyrs(rstable,rscondition,rsattribute,rsfield,rsfieldvalue)
if   rsattribute <> " ' ' "   then   allcondition= "   where   "&rscondition& "= "&rsattribute
exec= "select   *   from   "&rstable&allcondition
'response.write(exec)
rs.open   exec,conn,1,3
allrsfield=split(rsfield, "| ")
allrsfieldvalue=split(rsfieldvalue, "|| ")
for   i=0   to   Ubound(allrsfield)
rs(allrsfield(i))=allrsfieldvalue(i)
next
rs.update
end   function
'////////////////////////////////////////////////////////删除数据
function   deleters(rstable,rscondition,rsattribute)
if   rsattribute <> " ' ' "   then   allcondition= "   where   "&rscondition& "= "&rsattribute
exec= "delete   *   from   "&rstable&allcondition
'response.write(exec)
conn.execute   exec


end   function
'////////////////////////////////////////////////////////关闭数据表
function   closers()
rs.close()
end   function
'////////////////////////////////////////////////////////关闭数据库
function   closeconn()
set   rs=nothing
conn.close()
set   conn=nothing
end   function
%>


[解决办法]
是不是有关联的其他表,如果有主表存在的话就没办法删除辅表记录.

热点排行