| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 440 人关注过本帖
标题:好奇怪为什么这代码会在数据库里面生成两行数据
只看楼主 加入收藏
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
 问题点数:0 回复次数:2 
好奇怪为什么这代码会在数据库里面生成两行数据
<!--#Include File="Connection.Asp"-->
<!--#Include File="Function.Asp"-->
<!--#Include File="JaClog.Asp"-->
<%
If Request.QueryString("action")="do" Then
pic_name = JaKillStr(Trim(Request.Form("Na")))
piccat_id = JaKillStr(Trim(Request.Form("ty")))
pic_pic = JaKillStr(Trim(Request.Form("pic")))
content1 = JaKillStr(Trim(Request.Form("content1")))
if content1="没有介绍" then
end if
if pic_name="" then
Response.Write "<script language=javascript>alert('请填写图片标题!');"
Response.Write "window.document.location.href='addpic.Asp';</script>"
Response.End()
end if

if piccat_id=0 then
Response.Write "<script language=javascript>alert('请选择相册分类!');"
Response.Write "window.document.location.href='addpic.Asp';</script>"
Response.End()
end if

if pic_pic="" then
Response.Write "<script language=javascript>alert('没有上传图片!');"
Response.Write "window.document.location.href='addpic.Asp';</script>"
Response.End()
end if
set rs2=server.createobject("adodb.recordset")
sql2="select * from pic where piccat_id="&piccat_id
rs2.open sql2,conn,1,1
s=rs2.recordcount
s=s+1
set rs=server.createobject("adodb.recordset")
sql="select * from pic where isbest=1 "
rs.open sql,conn,1,3
SqlA = "INSERT INTO [pic](pic_name,piccat_id,pic_pic,content1,isbest,guestname,xlid)VALUES('"&pic_name&"','"&piccat_id&"','"&pic_pic&"','"&content1&"',0,'"&SESSION("JaAdmin")&"','"&s&"')"
Conn.ExeCute(SqlA)
Response.Write "<script language=javascript>alert('添加相片成功!');"
  Response.Write "window.document.location.href='photolist2.Asp';</script>"
  Response.End()
End If
%>
<HTML><HEAD><TITLE>无标题文档</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">

<LINK href="JaImg/css.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
</HEAD>

<BODY>
<form name="myform" method="post"  action="?action=do">
<TABLE class=itemhead height=25 cellSpacing=0 cellPadding=0 width="100%"
align=center border=0>
  <TBODY>
  <TR>
    <TD class=itemheadtd vAlign=bottom bgColor=#bcdbfe><table width="646" height="18" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="92" class="item"><a href="PhotoList.Asp"></a></td>
        <td width="133" class="item"><a href="addPhotoList.Asp"></a></td>
        <td width="129" class="item"><a href="addpic.Asp">添加相册图片</a></td>
        <td width="292" class="item"><a href="PhotoList2.Asp">管理相册图片</a></td>
      </tr>
    </table></TD>
      </TR></TBODY></TABLE>
<TABLE height=8 cellSpacing=0 cellPadding=0 width=100 border=0>
  <TBODY>
  <TR>
    <TD></TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=1 cellPadding=3 width="100%" align=center bgColor=#164481
border=0>
    <TBODY>
      <TR>
        <TD align=middle width="13%" bgColor=#daebfe height=25><STRONG>图 片 名 称:</STRONG></TD>
        <TD width="87%" bgColor=#E7EBF1> <INPUT
      name=Na id="Na" size=35>        </TD>
      </TR>
      <TR>
        <TD align=middle bgColor=#daebfe height=25><STRONG>图 片 分 类:</STRONG></TD>
        <TD bgColor=#E7EBF1><%
                 set rs2=server.createobject("adodb.recordset")
classname=SESSION("JaAdmin")
                 rs2.source="select  * from piccat where piccat_classname=1 order by piccat_id desc"
                 rs2.open rs2.source,conn,1,1
                 %>
                                          <select name=ty id="ty" onChange=go(this)>
                           <option value=0>请选择图片分类</option>
                                                  <%
                                                  for i=1 to rs2.RecordCount
                                                  qw=rs2("piccat_name")
                                               
                                                  
                                                  %>
                           <option value=<%=rs2("piccat_id")%>><%=qw%></option>
                       <%
                       rs2.movenext
                       next
                       %>   
  </select>        </TD>
      </TR>
      
      
      
      <TR>
        <TD align=middle bgColor=#daebfe height=25><STRONG>图 片 上 传:</STRONG></TD>
        <TD bgColor=#e7ebf1> <input name="pic" type="text" id="pic" size="35" readonly="true">
        <iframe marginwidth=0 framespacing=0 marginheight=0 frameborder=0 width=100% height=25 scrolling=no src="PhotoUpload.asp"></iframe>        </TD>
      </TR>
      
      
      <TR>
        <TD align=middle bgColor=#daebfe height=25><STRONG>图 片 介 绍:</STRONG></TD>
        <TD bgColor=#ffffff>
        <textarea name="content1" style="display:none" cols="1" rows="1">
          </textarea>
        <iframe id="eWebEditor1" src="../../Editor1/ewebeditor.asp?id=content1&style=yy" frameborder="0" scrolling="no" width="100%" height="320" marginwidth="1" marginheight="1" name="wfasdg"></iframe>        </TD>
      </TR>
      <TR>
        <TD align=middle bgColor=#daebfe height=35>&nbsp;</TD>
        <TD bgColor=#ffffff colSpan=2><INPUT class=button1 type=submit value=确认无误,我要添加 name=Submit23></TD>
      </TR>
    </TBODY>
  </TABLE>
</FORM>
</BODY></HTML>
搜索更多相关主题的帖子: 数据库 代码 
2007-12-18 11:03
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
Request.QueryString("action")="do"
<form name="myform" method="post"  action="?action=do">
这个myform是提交到本页?
2007-12-18 14:13
sydpoechang
Rank: 1
等 级:新手上路
帖 子:115
专家分:0
注 册:2007-8-22
收藏
得分:0 
是的
补丁补丁补丁补丁补丁补丁补丁补丁
2007-12-18 15:25
快速回复:好奇怪为什么这代码会在数据库里面生成两行数据
数据加载中...
 
   



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

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