| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 735 人关注过本帖
标题:求ASP修改后台的产品添加成功到数据库
只看楼主 加入收藏
itshi
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-6-21
收藏
 问题点数:0 回复次数:2 
求ASP修改后台的产品添加成功到数据库
请到www.下载一下程序,帮我改一下产品添加,如有成功请告诉我.谢谢...详细一点.本人比较菜.
后台登陆账号密码:admin

之前产品添加可以成功,但是我后来把一级分类,改成二级分类后就不上能成功添加数据了.但是程序没有错误,参数值也可以传递过去.

有空的好心人帮我一下吧.谢谢.
我找了好久找不出原因,只好来求救了.

或者我贴代码出来.或者在附件里下.谢谢.

prod_add.asp:
------------------------------------------------------------------------
<%dbdns="../../"%>
<!--#include file="../../inc/conn.asp"-->
<!--#include file="cook.asp"-->
<style type="text/css">
<!--
.style35 {    font-size: 12px;
    color: #666666;
}
-->
</style>
<script language="javascript">
function openwin()
{
window.open("../../imgup/uploadpr.asp","newwindow","height=300,width=400,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
}
</script>
<body style="margin:5">

<%sql = "select *  from lin_ypaddtwo order by lin_date desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1%>
<script language = "JavaScript">
var onecount1;
onecount1=0;
subcat1 = new Array();
<%count = 0
do while not rs.eof%>
subcat1[<%=count%>] = new Array("<%= trim(rs("lin_addtwo"))%>","<%= trim(rs("lin_addone_id"))%>","<%= trim(rs("lin_addtwo_id"))%>");
        <%count = count + 1
        rs.movenext
        loop
        rs.close
        set rs=nothing%>
onecount1=<%=count%>;

function changelocation1(addone)
    {
    document.addform.addtwo_id.length = 0;

    var addone_id=addone_id;
    var i;
    document.addform.addtwo_id.options[0] = new Option('请选择小类','');
    for (i=0;i < onecount1; i++)
        {
            if (subcat1[i][1] == addone)
            {
                document.addform.addtwo_id.options[document.addform.addtwo_id.length] = new Option(subcat1[i][0], subcat1[i][2]);
            }        
        }
        
    }
</script>

<script language="JavaScript">
<!--
function checkdata() {
if( addform.z_name.value =="") {
alert("\发布出错,下面是产生错误的可能原因:\n\n·请输入产品名称")
return false;
}
if( addform.addone_id.value =="" || addform.addtwo_id.value =="" ) {
alert("\发布出错,下面是产生错误的可能原因:\n\n·请输入产品类别")
return false;
}
if( addform.pic.value =="") {
alert("\发布出错,下面是产生错误的可能原因:\n\n·请加入产品图片")
return false;
}

return true;
}
// -->
</script>

<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<form name="addform" method="post" action="prod_save.asp?action=add" onSubmit="return checkdata()">
  <tr>
    <td height=30 align="center" colspan="8"><font color=#666666>带 * 为必填项</font></td>
  </tr>
  <tr>
    <td width="12%" height=30 align=right><font color=red>*</font>产品名称: &nbsp;</td>
    <td colspan="7"><input name="z_name" type="text" size="35" maxlength="100">
</td>
  </tr>

  <tr>
    <td height=50 align=right><font color="red">*</font>产品类别: &nbsp;</td>
    <td colspan="7"><p style="line-height:180%"><select name="addone_id" onChange="changelocation1(document.addform.addone_id.options[document.addform.addone_id.selectedIndex].value)">
<option value="" selected>请选择大类</option>
                    <%
sql="select *  from lin_ypaddone order by lin_date desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
while not rs.eof%>
<option value="<%=rs("lin_addone_id")%>"><%=rs("lin_addone")%></option>
<%rs.movenext
wend
rs.Close()
%>
</select>
<select name="addtwo_id">
<option selected value="">请选择小类</option>
</select></td>
  </tr>
 
  <tr>
    <td width="12%" height=30 align=right><font color=red>*</font>产品内容: &nbsp;</td>
    <td colspan="7"><p style="line-height:180%"><INPUT type="hidden" name="z_lr" value="">
                                    <iframe ID="eWebEditor1" src="../editor/ewebeditor.asp?id=nr&style=s_light" frameborder="0" scrolling="no" width="550" HEIGHT="350"> </iframe>
    </td>
  </tr>
  <tr>
    <td height=30 align=right><div align="center"><font color="red">*</font>产品图片</div></td>
    <td colspan="7"><span class="style35">
      <input name="pic" type="text" id="pic" size="35">
      <a href="#" onClick="openwin()">上传图片</a> </span></td>
  </tr>

  <tr>
    <td height=30 align="center" colspan="8"><input type="submit" name="Submit" value="提 交" class="input1"></td>
  </tr>
</form>
</table>

<script language="javascript">
    changelocation1(document.addform.addone_id.options[document.addform.addone_id.selectedIndex].value);
</script>
</body>
</html>


------------------------------------------------------------------------
prod_save.asp
--------------------------------------------------------------------------
<%dbdns="../../"%>
<!--#include file="../../inc/conn.asp"-->
<!--#include file="cook.asp"-->
<%
z_name=request("z_name")
addone_id=request("addone_id")
addtwo_id=request("addtwo_id")
z_lr=request("z_lr")
pic=request("pic")


if request.QueryString("action")="add" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from linprod"
rs.open sql,conn,1,3
rs.movelast
rs.addnew
rs("lin_title")=z_name
rs("lin_addone_id")=addone_id
rs("lin_addtwo_id")=addtwo_id
rs("lin_z_lr")=z_lr
rs("lin_img")=pic
rs("lin_time")=date()
rs.update
rs.close
set rs=nothing
response.redirect"prod_add.asp"
else
response.Write"<script language=javascript> alert('您添加的产品已经存在,请确认是否相同再来添加!');window.location='prod_add.asp';</script>"

end if
%>
<%
page=request("page")
if page="" then page=1

if request.QueryString("action")<>"add" and request.QueryString("action")="edit" then
id=cint(request("id"))
z_name=request("z_name")
addone_id=request("addone_id")
addtwo_id=request("addtwo_id")
z_lr=request("z_lr")
pic=request("pic")

set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from linprod where SMT_id="&id
rs.open sql,conn,1,3
rs("lin_title")=z_name
rs("lin_addone_id")=addone_id
rs("lin_addtwo_id")=addtwo_id
rs("lin_z_lr")=z_lr
rs("lin_img")=pic
rs("lin_time")=date()
rs.Update
rs.Close
set rs=nothing
Response.Redirect "prod.asp"

end if
%>

lin.rar (647.04 KB)
搜索更多相关主题的帖子: 数据库 后台 ASP admin 
2008-06-21 23:08
itshi
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-6-21
收藏
得分:0 
大家帮帮忙呀.
2008-06-22 11:55
itshi
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-6-21
收藏
得分:0 
该问题已关闭
2008-06-23 23:45
快速回复:求ASP修改后台的产品添加成功到数据库
数据加载中...
 
   



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

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