当前位置:编程学习 > asp >>

ASP 删除数据代码

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
margin-top: 0px;
}
-->
</style></head>

<body>
<% Set rs=Server.CreateObject("ADODB.Recordset")
exec="select * from admin"
rs.open exec,conn,1,1
%>
<table width="800" border="0" align="center">
<tr>
<td align="center"><strong>管理员列表</strong></td>
</tr>
<tr>
<td><table width="600" border="1" align="center">
<tr align="center">
<td width="192">账号</td>
<td width="192">密码</td>
<td width="194">操作</td>
</tr>
<% Do While Not rs.EOF %>
<tr align="center">
<td><%=rs("username")%></td>
<td><%=rs("password")%></td>
<td>编辑 <a href="admin_del.asp?username=<%=rs("username")%>">删除</a></td>
</tr>
<%
rs.MoveNext
Loop
%>
</table></td>
</tr>
</table>
</body>
</html>
连接把值传递到del.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<%
user=request.querystring("username")
sql = "delete from admin where username="&user
Conn.Execute(sql)
response.redirect "admin_list.asp"
%>
调试的时候总是出错,问下大家错在哪?
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,