| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 498 人关注过本帖
标题:添加同样的内容无法添加,(自己摸索着解决了)谢谢ysf0181版主。
取消只看楼主 加入收藏
lxb0592
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2012-5-28
结帖率:86.67%
收藏
 问题点数:0 回复次数:1 
添加同样的内容无法添加,(自己摸索着解决了)谢谢ysf0181版主。
添加内容只能添加一次,第二次添加同样的内容则无法添加。
如图,添加了一次内容的前台显示
图片附件: 游客没有浏览图片的权限,请 登录注册

再次添加,则无法添加。
图片附件: 游客没有浏览图片的权限,请 登录注册


我们经常要碰到添加同样的内容。(再次谢谢ysf0181版主)  下面是添加内容页的代码。看是哪儿要修改下。

<%
if request.Cookies("shiwei_username")="" then
%>
<script language="javascript">
top.location.href="../index.asp"
</script>
<%  
  response.end
end if
%>
<!-- #include file="../conn2.asp" -->
<!-- #include file="../const.asp" -->

<html>
<head>
<title><%=dianming%> - 添加档案</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style>
body {
    background-color:#FFFFFF;
}
</style>
</HEAD>

<BODY>
<%
if fla35="0" and request.Cookies("shiwei_id")<>"1" then
%>
<br><center><img src="../images/note.gif" align="absmiddle">&nbsp;<font color="#FF0000">你不具备此权限,请与管理员联系!</font></center>
<%  
  response.end
end if
%>
<%if request("hid1")="" then%>
<script language="javascript">
function check()
{
if (document.form1.username.value==""||document.form1.card.value=="")
{
alert("有*号的必须填写!");
return false;
}
}
</script>
<form name="form1">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;添加档案(带*号的为必填项)</td>
      <td align="right">&nbsp;</td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
      <tr>
        <td width="25%" height="30" align="right">所属工区:</td>
        <td width="75%" class="category">
    <%
    sql="select * from zu_huiyuan order by id"
    set rs_zu=conn.execute(sql)
    if rs_zu.eof then
    %>
    <script language="javascript">
      alert("请先添加公司名称!")
      window.location.href="gongsi_add.asp"
    </script>
    <%
    response.end
    end if
    %>
      <select name="id_zu">
        <%
    do while rs_zu.eof=false
    %>
        <option value="<%=rs_zu("id")%>"><%=rs_zu("zu")%></option>
        <%
      rs_zu.movenext
    loop
    %>
      </select>        </td>
      </tr>
      <tr>
        <td align="right" height="30">值班人员:</td>
        <td class="category"><input type="text" name="username" style="width:200px">&nbsp;&nbsp;<font color="#ff0000">*</font></td>
      </tr>
      <tr>
        <td height="30" align="right">AEI:</td>
        <td class="category"><input type="text" name="card" style="width:200px">
          &nbsp;<font color="#ff0000">*</font></td>
      </tr>
      <tr>
        <td height="30" align="right">TFDS:</td>
        <td class="category"><input type="text" name="sfz" style="width:200px"></td>
        </tr>
      <tr>
        <td align="right" height="30">TP/TA:</td>
        <td class="category"><input type="text" name="email" style="width:200px"></td>
      </tr>
      <tr>
        <td align="right" height="30">THDS: </td>
        <td class="category"><input type="text" name="tel" style="width:200px"></td>
      </tr>
      <tr>
        <td align="right" height="30">填写人员:</td>
        <td class="category">
          <%
          if request.Cookies("shiwei_id")=1 then
            sql="select * from login order by id_zu,id"
            set rs_login=conn.execute(sql)
          else
            sql="select * from login where id="&request.Cookies("shiwei_id")
            set rs_login=conn.execute(sql)      
          end if
          if rs_login.eof then
          %>
          <script language="javascript">
            alert("请先添加员工!")
            window.location.href="../system/user_add.asp"
          </script>
          <%
          response.end
          else
          %>
          <select name="id_login">
          <%
          do while rs_login.eof=false
          %>
            <option value="<%=rs_login("id")%>"<%if trim(cstr(rs_login("id")))=trim(cstr(request.Cookies("shiwei_id"))) then%> selected="selected"<%end if%>><%=rs_login("username")%> (<%=rs_login("bianhao")%>)</option>
          <%
            rs_login.movenext
          loop
          %>
          </select>
          <%
          end if
          %>        </td>
      </tr>      
      <tr>
        <td align="right" height="30">值班时间:</td>
        <td class="category"><input name="startdate" value="<%=date()%>" readonly style="width:150px">
          <img src="../images/date.gif" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('day.asp?form=form1&field=startdate&oldDate='+startdate.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=500,left=520');">        默认保存时间为一年</td>
      </tr>           
      <tr>
        <td align="right" height="30">备注:</td>
        <td class="category"><textarea name="beizhu" cols="70" rows="4"></textarea></td>
      </tr>      
      <tr>
        <td height="30">&nbsp;</td>
        <td class="category">
          <input type="submit" value=" 确认添加 " onClick="return check()" class="button">&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="hidden" name="hid1" value="ok">
          <input type="reset" value=" 重新填写 " class="button">        </td>
      </tr>        
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</form>
<%
else
nowqq=request("qq")
nowemail=request("email")
nowid_zu=request("id_zu")
nowusername=request("username")
nowxinbie=request("xinbie")
nowtel=request("tel")
nowaddress=request("address")
nowsfz=request("sfz")
nowjieshao=request("jieshao")
nowcard=request("card")
nowid_login=request("id_login")
nowstartdate=request("startdate")
nowshenri1=request("shenri1")
nowshenri2=request("shenri2")
nowshenri3=request("shenri3")
nowyinyan=request("yinyan")
nowshenri=nowshenri1&"-"&nowshenri2&"-"&nowshenri3
nowenddate=cdate(nowstartdate)+2
nowbeizhu=request("beizhu")
bx11=request("bx1")
bx21=request("bx2")
bx31=request("bx3")
bx41=request("bx4")
bx51=request("bx5")
bx61=request("bx6")
sql="select * from huiyuan where card='"&nowcard&"'"
set rs=conn.execute(sql)
if rs.eof=false then
%>
 
<%
  response.end
end if

if nowjieshao="" then
  nowjieshao=0
else
  sql="update huiyuan set jifen=jifen+"&jieshaojifen&" where id="&nowjieshao
  conn.execute(sql)
end if

set rs_login=conn.execute("select * from login where id="&nowid_login)
nowlogin=rs_login("username")
sql="insert into huiyuan(username,xinbie,tel,address,sfz,jieshao,card,id_login,login,startdate,enddate,beizhu,yinyan,qq,email,id_zu,bx1,bx2,bx3,bx4,bx5,bx6) values('"&nowusername&"','"&nowxinbie&"','"&nowtel&"','"&nowaddress&"','"&nowsfz&"',"&nowjieshao&",'"&nowcard&"',"&nowid_login&",'"&nowlogin&"',#"&nowstartdate&"#,#"&nowenddate&"#,'"&nowbeizhu&"','"&nowyinyan&"','"&nowqq&"','"&nowemail&"',"&nowid_zu&",'"&bx11&"','"&bx21&"','"&bx31&"','"&bx41&"','"&bx51&"','"&bx61&"')"
conn.execute(sql)
%>
<script language="javascript">
alert("档案添加成功!")
window.location.href="dangan.asp"
</script>
<%
end if
%>
</body>
</html>

[ 本帖最后由 lxb0592 于 2012-6-13 22:25 编辑 ]
搜索更多相关主题的帖子: include file 
2012-06-13 17:47
lxb0592
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2012-5-28
收藏
得分:0 
sql="select * from huiyuan where card='"&nowcard&"'"
set rs=conn.execute(sql)
if rs.eof=false(false 改成true问题解决了) then
2012-06-13 22:26
快速回复:添加同样的内容无法添加,(自己摸索着解决了)谢谢ysf0181版主。
数据加载中...
 
   



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

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