ASP删除ACCESS数据库问题!
<!--#includefile="conn.asp"--><!--#includefile="check.asp"--><head><metahttp-equiv="C...
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除用户</title>
<style type="text/css">
<!--
.style2 {font-size: 12px}
.style3 {font-size: 12px; color: #FFFFFF; }
a:link {
text-decoration: none;
color: #FFFFFF;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="555" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="18" bgcolor="#0066CC">
<div class=style3 align=center>
<div align="left"><a href="add.asp">添加用户</a> | <a href="del.asp">删除用户</a> |
</div>
</div>
</td>
</tr>
<tr>
<td height="18"><span class="style2">当前用户:<%=session("user")%> 当前日期时间:<%=now()%></span></td>
</tr>
</table>
<table width="555" border="0" cellpadding="0" cellspacing="0" align="center" >
<tr><td colspan="5"></tr>
<tr height="50">
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>ID</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>帐户</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>名称</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>密码</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>操作</b></td>
</tr>
<%
Set rs=server.createobject("adodb.recordset")
sql="select * from username"
rs.Open sql,conn,1,1
if rs.eof or rs.bof then
response.write ("暂无信息")
else
%>
<%
do while not rs.eof
%>
<tr>
<td bordercolor="#CCCCCC" align="center"><%=rs("id")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("user")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("beizhu")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("pass")%></td>
<td bordercolor="#000000" align="center"><a href="?action=del&id=<%=rs("id")%>" >删除</a></td>
</tr>
<%
rs.movenext
loop
%>
<%
conn.close
set conn=nothing
end if
%>
</table>
<%
if request("action")="del" then
set rs=server.CreateObject("adodb.recordset")
id=request.form("id")
conn.execute "delete from username where id ="&id(这里出错,提示Microsoft VBScript 运行时错误 '800a01a8'
缺少对象: 'conn'
\manage\del.asp, line 104
)
set conn=nothing
rs.Close
set rs=nothing
end if
%>
</body>
两个问题 1, 删除按键 那里是白色 和背景色一样,调整不过来,不知道为什吗?
2。点击删除后,提示Microsoft VBScript 运行时错误 '800a01a8'
缺少对象: 'conn'
\manage\del.asp, line 104
。搞不明白
盼高手解答,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
conn.asp在同一目录下
<%
set conn= server.createobject("adodb.connection")
sql = "provider=microsoft.jet.oledb.4.0;data source="&server.mappath("..\database\air.mdb")
conn.open sql
%>
<!--- 定义数据库联接文件---> 展开
<!--#include file="check.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除用户</title>
<style type="text/css">
<!--
.style2 {font-size: 12px}
.style3 {font-size: 12px; color: #FFFFFF; }
a:link {
text-decoration: none;
color: #FFFFFF;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="555" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="18" bgcolor="#0066CC">
<div class=style3 align=center>
<div align="left"><a href="add.asp">添加用户</a> | <a href="del.asp">删除用户</a> |
</div>
</div>
</td>
</tr>
<tr>
<td height="18"><span class="style2">当前用户:<%=session("user")%> 当前日期时间:<%=now()%></span></td>
</tr>
</table>
<table width="555" border="0" cellpadding="0" cellspacing="0" align="center" >
<tr><td colspan="5"></tr>
<tr height="50">
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>ID</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>帐户</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>名称</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>密码</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>操作</b></td>
</tr>
<%
Set rs=server.createobject("adodb.recordset")
sql="select * from username"
rs.Open sql,conn,1,1
if rs.eof or rs.bof then
response.write ("暂无信息")
else
%>
<%
do while not rs.eof
%>
<tr>
<td bordercolor="#CCCCCC" align="center"><%=rs("id")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("user")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("beizhu")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("pass")%></td>
<td bordercolor="#000000" align="center"><a href="?action=del&id=<%=rs("id")%>" >删除</a></td>
</tr>
<%
rs.movenext
loop
%>
<%
conn.close
set conn=nothing
end if
%>
</table>
<%
if request("action")="del" then
set rs=server.CreateObject("adodb.recordset")
id=request.form("id")
conn.execute "delete from username where id ="&id(这里出错,提示Microsoft VBScript 运行时错误 '800a01a8'
缺少对象: 'conn'
\manage\del.asp, line 104
)
set conn=nothing
rs.Close
set rs=nothing
end if
%>
</body>
两个问题 1, 删除按键 那里是白色 和背景色一样,调整不过来,不知道为什吗?
2。点击删除后,提示Microsoft VBScript 运行时错误 '800a01a8'
缺少对象: 'conn'
\manage\del.asp, line 104
。搞不明白
盼高手解答,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
conn.asp在同一目录下
<%
set conn= server.createobject("adodb.connection")
sql = "provider=microsoft.jet.oledb.4.0;data source="&server.mappath("..\database\air.mdb")
conn.open sql
%>
<!--- 定义数据库联接文件---> 展开
4个回答
展开全部
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除用户</title>
<style type="text/css">
<!--
.style2 {font-size: 12px}
.style3 {font-size: 12px; color: #FFFFFF; }
a:link {
text-decoration: none;
color: #FFFFFF;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="555" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="18" bgcolor="#0066CC">
<div class=style3 align=center>
<div align="left"><a href="add.asp">添加用户</a> | <a href="del.asp">删除用户</a> |
</div>
</div>
</td>
</tr>
<tr>
<td height="18"><span class="style2">当前用户:<%=session("user")%> 当前日期时间:<%=now()%></span></td>
</tr>
</table>
<table width="555" border="0" cellpadding="0" cellspacing="0" align="center" >
<tr><td colspan="5"></tr>
<tr height="50">
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>ID</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>帐户</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>名称</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>密码</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>操作</b></td>
</tr>
<%
if request("action")="del" then
conn.execute "delete from username where id ="&id
end if
Set rs=server.createobject("adodb.recordset")
sql="select * from username"
rs.Open sql,conn,1,3
if rs.eof or rs.bof then
response.write ("暂无信息")
rs.close
set rs=nothing
conn.close
set conn=nothing
else
%>
<%
<%
do while not rs.eof
%>
<tr>
<td bordercolor="#CCCCCC" align="center"><%=rs("id")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("user")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("beizhu")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("pass")%></td>
<td bordercolor="#000000" align="center"><a href="?action=del&id=<%=rs("id")%>" >删除</a></td>
</tr>
<%
rs.movenext
loop
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
</table>
</body>
<!--#include file="check.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除用户</title>
<style type="text/css">
<!--
.style2 {font-size: 12px}
.style3 {font-size: 12px; color: #FFFFFF; }
a:link {
text-decoration: none;
color: #FFFFFF;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="555" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="18" bgcolor="#0066CC">
<div class=style3 align=center>
<div align="left"><a href="add.asp">添加用户</a> | <a href="del.asp">删除用户</a> |
</div>
</div>
</td>
</tr>
<tr>
<td height="18"><span class="style2">当前用户:<%=session("user")%> 当前日期时间:<%=now()%></span></td>
</tr>
</table>
<table width="555" border="0" cellpadding="0" cellspacing="0" align="center" >
<tr><td colspan="5"></tr>
<tr height="50">
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>ID</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>帐户</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>名称</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>密码</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>操作</b></td>
</tr>
<%
if request("action")="del" then
conn.execute "delete from username where id ="&id
end if
Set rs=server.createobject("adodb.recordset")
sql="select * from username"
rs.Open sql,conn,1,3
if rs.eof or rs.bof then
response.write ("暂无信息")
rs.close
set rs=nothing
conn.close
set conn=nothing
else
%>
<%
<%
do while not rs.eof
%>
<tr>
<td bordercolor="#CCCCCC" align="center"><%=rs("id")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("user")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("beizhu")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("pass")%></td>
<td bordercolor="#000000" align="center"><a href="?action=del&id=<%=rs("id")%>" >删除</a></td>
</tr>
<%
rs.movenext
loop
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
</table>
</body>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2010-04-27
展开全部
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除
a:link {
text-decoration: none;
color: #FFFFFF;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="555" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="18" bgcolor="#0066CC">
<div class=style3 align=center>
<div align="left"><a href="add.asp">添加用户</a> | <a href="del.asp">删除用户</a> |
</div>
</div>
</td>
</tr>
<tr>
<td height="18"><span class="style2">当前用户:<%=session("user")%> 当前日期时间:<%=now()%></span></td>
</tr>
</table>
<table width="555" border="0" cellpadding="0" cellspacing="0" align="center" >
<tr><td colspan="5"></tr>
<tr height="50">
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>ID</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>帐户</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>名称</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>密码</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>操作</b></td>
</tr>
<%
if request("action")="del" then
conn.execute "delete from username where id ="&id
end if
Set rs=server.createobject("adodb.recordset")
sql="select * from username"
rs.Open sql,conn,1,3
if rs.eof or rs.bof then
response.write ("暂无信息")
rs.close
set rs=nothing
conn.close
set conn=nothing
else
%>
<%
<%
do while not rs.eof
%>
<tr>
<td bordercolor="#CCCCCC" align="center"><%=rs("id")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("user")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("beizhu")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("pass")%></td>
<td bordercolor="#000000" align="center"><a href="?action=del&id=<%=rs("id")%>" >删除</a></td>
</tr>
<%
rs.movenext
loop
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
</table>
</body
<!--#include file="check.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除
a:link {
text-decoration: none;
color: #FFFFFF;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="555" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="18" bgcolor="#0066CC">
<div class=style3 align=center>
<div align="left"><a href="add.asp">添加用户</a> | <a href="del.asp">删除用户</a> |
</div>
</div>
</td>
</tr>
<tr>
<td height="18"><span class="style2">当前用户:<%=session("user")%> 当前日期时间:<%=now()%></span></td>
</tr>
</table>
<table width="555" border="0" cellpadding="0" cellspacing="0" align="center" >
<tr><td colspan="5"></tr>
<tr height="50">
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>ID</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>帐户</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>名称</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>密码</b></td>
<td width="111" bordercolor="#CCCCCC" bgcolor="#EBEBEB" align="center"><b>操作</b></td>
</tr>
<%
if request("action")="del" then
conn.execute "delete from username where id ="&id
end if
Set rs=server.createobject("adodb.recordset")
sql="select * from username"
rs.Open sql,conn,1,3
if rs.eof or rs.bof then
response.write ("暂无信息")
rs.close
set rs=nothing
conn.close
set conn=nothing
else
%>
<%
<%
do while not rs.eof
%>
<tr>
<td bordercolor="#CCCCCC" align="center"><%=rs("id")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("user")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("beizhu")%></td>
<td bordercolor="#CCCCCC" align="center"><%=rs("pass")%></td>
<td bordercolor="#000000" align="center"><a href="?action=del&id=<%=rs("id")%>" >删除</a></td>
</tr>
<%
rs.movenext
loop
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
</table>
</body
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
conn.execute "delete from username where id ="&id
换成
sql="delete from username where id ="&id
rs.open sql,conn,1,3
换成
sql="delete from username where id ="&id
rs.open sql,conn,1,3
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
id=request.form("id") 这样是获取不到网址中的参数的
请写id=request("id")
请写id=request("id")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询