广告图片上传成功,但数据没有添加进数据库 没有提示错误

seymour_glass 2009-09-11 11:37:37
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="UrlCheck.asp"-->
<!--#include file="islogin.asp"-->
<!--#include file="Check_SqlIn.asp"-->
<!--#include file="../inc/conn.asp"-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>添加广告</title>
<LINK href="admin_Css.css" type=text/css rel=stylesheet>
<script type="text/javascript">
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.Name != "chkAll"&&e.disabled!=true)
e.checked = form.chkAll.checked;
}
}
</script>
</head>
<body>
<%
If Request("action")="save" Then
If Trim(Cstr(Request("adname")))="" or IsEmpty(Request("adname")) Then
adname="未命名"
Else
adname=Trim(Cstr(Request("adname")))
End if

If Trim(Request("position"))="" or IsEmpty(Request("position")) Then
position=0
Else
position=Trim(Request("position"))
End if

Set rs=Server.CreateObject("Adodb.RecordSet")
If Trim(Cint(Request("id")))<>"" Then
sql="select * from ad where id="&Request("id")
rs.open sql,conn,3,3
rs("name")=adname
rs("type")=Request("type")
rs("pic")=Trim(Request("pic"))
rs("url")="http://"&Trim(Request("url"))
rs("flash")=Request("flash")
rs("city")=Request("city")
rs("position")=position
rs.Update
Else
sql="select * from ad"
rs.open sql,conn,3,3
rs.Addnew
rs("name")=adname
rs("type")=Request("type")
rs("pic")=Trim(Request("pic"))
rs("url")="http://"&Trim(Request("url"))
rs("flash")=Request("flash")
rs("city")=Request("city")
rs("position")=position
rs.Update
End if

Response.Write("<center><font color=red>添加/修改成功!您可以继续添加/修改</font></center>")
End if
%>

<%
If Request("id")<>"" Then
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from ad where id="&Cint(Request("id"))
rs.open sql,conn,1,3
End If
%>
<table width="529" border="0" align="center" cellpadding="0" cellspacing="1" class="table_back">
<form action="admin_ad_add.asp?action=save&id=<%=Request("id")%>" method="post" name="article">
<tr>
<td colspan="4" align="center" class="table_title" height="30px">添加广告</td>
</tr>
<tr>
<td width="142" align="center" class="table_td2">广告名称</td>
<td width="368" colspan="3" align="left" class="table_td2" height="30px">  <input name="adname" type="text" size="40" value="<%=rs("name")%>"/></td>
</tr>
<tr>
<td align="center" class="table_td2">类别</td>
<td colspan="3" align="left" class="table_td2" height="30px">  <select name="type">
<option value="1" <%if rs("type")=1 then Response.Write("selected")%>>最上方横幅广告</option>
<option value="2" <%if rs("type")=2 then Response.Write("selected")%>>分区重点推荐招聘</option>
<option value="3" <%if rs("type")=3 then Response.Write("selected")%>>品牌企业</option>
<option value="4" <%if rs("type")=4 then Response.Write("selected")%>>中间横幅广告</option>
<option value="5" <%if rs("type")=5 then Response.Write("selected")%>>轮播广告</option>
</select> </td>
</tr>
<tr>
<td align="center" class="table_td2">广告地址</td>
<td colspan="3" align="left" class="table_td2" height="30px">  <input name="pic" type="text" size="40" value="<%=rs("pic")%>"/></td>
</tr>
<tr>
<td align="center" class="table_td2">广告上传</td>
<td colspan="3" align="left" class="table_td2" height="30px">  <iframe style="top:2px" ID="admin_upload" src="../admin_upload.asp" frameborder=0 scrolling=no width="350" height="20"></iframe></td>
</tr>
<tr>
<td align="center" class="table_td2">连接网址</td>
<td colspan="3" align="left" class="table_td2" height="30px">  http://
<input name="url" type="text" size="33" value="<%=Replace(rs("url"),"http://","")%>"></td>
</tr>
<tr>
<td align="center" class="table_td2">是否FLASH</td>
<td colspan="3" align="left" class="table_td2" height="30px">  <input name="flash" type="radio" value="false" <%if rs("flash")=0 then Response.Write("checked")%>/>

<input type="radio" name="flash" value="true" <%if rs("flash")=1 then Response.Write("checked")%>/>
是</td>
</tr>
<tr>
<td align="center" class="table_td2">排位</td>
<td colspan="3" align="left" class="table_td2" height="30px">  <input name="position" type="text" size="5" value="<%=rs("position")%>"/>
(数字 数值越大排位越靠前 默认为0 )</td>
</tr>
<tr>
<td align="center" class="table_td2"><p>显示地区<br />
(首页轮播广告不用选择)</p> </td>
<td colspan="3" align="left" class="table_td2" height="30px">
<input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">全选
<%set rs2=server.CreateObject("adodb.recordset")
sql2="select city from adcity order by id asc"
rs2.open sql2,conn,1,1
do while not rs2.eof
%>
<input type="checkbox" name="city" value="<%=rs2("city")%>"><%=rs2("city")%>
<%rs2.movenext
loop
rs2.close
set rs2=nothing%></td>
</tr>
<tr>
<td colspan="4" align="center" class="table_td2" height="30px"><input type="submit" name="Submit" value="提交" /></td>
</tr>
</form>
</table>
<br />
<br />
<table width="413" border="0" align="center" cellpadding="0" cellspacing="1" class="table_back">
<tr>
<td colspan="2" align="center" class="table_title">广告尺寸</td>
</tr>
<tr>
<td width="135" align="center" class="table_td2">最上方横幅广告</td>
<td width="259" class="table_td2"><div align="center">710*85</div></td>
</tr>
<tr>
<td align="center" class="table_td2">品牌企业</td>
<td class="table_td2"><div align="center">260*60</div></td>
</tr>
<tr>
<td align="center" class="table_td2">中间横幅广告</td>
<td class="table_td2"><div align="center">740*100</div></td>
</tr>
<tr>
<td align="center" class="table_td2">轮播广告</td>
<td class="table_td2"><div align="center">465*190</div></td>
</tr>
</table>

</body>
</html>
...全文
94 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuwei_IT_love 2009-09-15
  • 打赏
  • 举报
回复
查看一下路径,再有考虑一下rs("url")="http://"&Trim(Request("url")) 改成rs("url")=Trim(Request("url")) 试试
mailbao 2009-09-15
  • 打赏
  • 举报
回复
問題出現的可能原因:
1.數據庫沒有足夠的權限來操作
2.上傳的圖片路徑傳進保存頁面時丟失或無效
3.表單中有未知的變量與數據庫表的實際字段不相符

自己斷點Response.write一下看看是哪個環節出問題了就OK
凡夫与俗子 2009-09-15
  • 打赏
  • 举报
回复
在If Request("action")="save" Then之前先response.write "action="&request("action") 看看
凡夫与俗子 2009-09-15
  • 打赏
  • 举报
回复
你确定action传到了?按你的描述,我估计是action没传过来,所以没报错,但不更新。
sayfree 2009-09-14
  • 打赏
  • 举报
回复
看看数据库的字段或者变量是否写正确了。
loveshuang942 2009-09-14
  • 打赏
  • 举报
回复
你存的是路径吗?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧