| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 296 人关注过本帖
标题:asp菜鸟问题求助!
取消只看楼主 加入收藏
QQ玉米地
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-5-31
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
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>&nbsp;</p>
      <p>&nbsp;</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>

2010-05-31 16:56
QQ玉米地
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-5-31
收藏
得分:0 
问题已解决 谢谢大家!!
2010-05-31 17:20
快速回复:asp菜鸟问题求助!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018108 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved