asp菜鸟问题求助!
我刚学asp 在做动态网站,但删除出了问题。先执行查询后对查询后结果执行删除操作,但ACCESS表中实际上并没有删除成功。现将与这相关的两端代码发上来 恳请各位大侠指教!新人不甚感激!
search_yundancheck.asp文件:
<%@ language="VBSCRIPT" codepage="936" %>
<!-- #include file="inc/conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询运单数据处理文件</title>
<link href="css.css" type=text/css rel=stylesheet>
</head>
<body>
<%
Dim sel,key
sel=Request.form("sel")
key=Request.form("key")
if sel="请选择查询字段" then
response.write "<script language='javascript'>" & VbCRlf
response.write("alert('请先选择要查询的字段!');") & VbCrlf
response.write("location.href='search_yundan.asp';")
response.write "</script>" & VbCRLF
elseif key="" then
response.write("alert('查询关键字不能为空!');")
response.write("location.href='search_yundan.asp';")
else
set rs=server.createobject("adodb.recordset")
if sel="运单编号" then
sql="select * from ydsj where yundanbianhao='"&key&"'"
elseif sel="用户编码" then
sql="select * from ydsj where yonghubianma='"&key&"'"
elseif sel="用户名称" then
sql="select * from ydsj where yonghumingcheng='"&key&"'"
elseif sel="到站" then
sql="select * from ydsj where daozhan='"&key&"'"
elseif sel="专用线" then
sql="select * from ydsj where zhuanyongxian='"&key&"'"
elseif sel="运输号" then
sql="select * from ydsj where yunshuhao='"&key&"'"
elseif sel="车次" then
sql="select * from ydsj where checi='"&key&"'"
elseif sel="车号" then
sql="select * from ydsj where chehao='"&key&"'"
elseif sel="重量" then
sql="select * from ydsj where zhongliang='"&key&"'"
elseif sel="矿种" then
sql="select * from ydsj where kuangzhong='"&key&"'"
elseif sel="矿别" then
sql="select * from ydsj where kuangbie='"&key&"'"
end if
rs.open sql,conn,1,3
if rs.eof then
response.write "<script language='javascript'>" & VbCRlf
response.write "alert('没有查询到你想查询运单!');" & VbCrlf
response.write("location.href='search_yundan.asp';")
response.write "</script>" & VbCRLF
else %>
<table width="750" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" align="center">
<tr>
<td>
运单编号
</td>
<td>
用户编码
</td>
<td>
用户名称
</td>
<td>
到站
</td>
<td>
专用线
</td>
<td>
运输号
</td>
<td>
车次
</td>
<td>
车号
</td>
<td>
重量
</td>
<td>
矿别
</td>
<td>
矿种
</td>
</tr>
<% do while not rs.eof
response.write("<tr>")
response.write("<td>" + rs("yundanbianhao") + "</td>")
response.write("<td>" + rs("yonghubianma") + "</td>")
response.write("<td>" + rs("yonghumingcheng") + "</td>")
response.write("<td>" + rs("daozhan") + "</td>")
response.write("<td>" + rs("zhuanyongxian") + "</td>")
response.write("<td>" + rs("yunshuhao") + "</td>")
response.write("<td>" + rs("checi") + "</td>")
response.write("<td>" + rs("chehao") + "</td>")
response.write("<td>" + rs("zhongliang") + "</td>")
response.write("<td>" + rs("kuangbie") + "</td>")
response.write("<td>" + rs("kuangzhong") + "</td>")
response.write("<td>" + "<a href=renew.asp>修改</a>"+ "</td>")
response.write("<td>" + "<a href=delete.asp?id=rs(yundanbianhao)>删除</a>"+ "</td>")
response.write("</tr>")
rs.movenext
loop
rs.close
set rs=nothing
end if
end if
%>
</table>
<p> </p>
<p> </p>
<div align="right" class="print">打印
</div>
</body>
</html>
delete.asp代码:
<%@LANGUAGE="VBScript" codepage="936"%>
<!-- #include file="inc/conn.asp" -->
<%
set rs=server.createobject("adodb.recordset")
id=Request.QueryString("id")
sql="select * from ydsj where yundanbianhao='"&id&"'"
rs.open sql,conn,2,3
rs.delete
rs.update
rs.close
response.write "<script language='javascript'>" & VbCRlf
response.write("alert('删除成功!');") & VbCrlf
response.write("location.href='search_yundan.asp';")
response.write "</script>" & VbCRLF
%>
<html>
<head>
<title>删除代码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
</html>