SQL插入数据显示成功,但是数据库没有记录

zhanglixin1234567 2009-08-11 03:17:56

我生成的SQL脚本,复制的表,大概意思就是这样,别的栏目用能是好的,我想复制一个栏目,改下链接名,改下表名,可是显示成功,但数据库没记录,高手指点下

add_news.asp

<!--#include file="../inc/top.asp" -->
<!--#include file="inc/check_qx.asp" -->
<!--#include file="../inc/downlist.asp"-->


<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#E8E8E8" class="t1">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10" height="25" bgcolor="#E8E8E8"> </td>
<td width="10" height="25" bgcolor="#F0F0F0"> </td>
<td bgcolor="#F7F7F7" class="font14pxB">添加教材信息</td>
</tr>
<tr>
<td height="5" colspan="3"> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30" height="20"> </td>
<td height="20" class="linkText"><span class="linkText"><strong>S:</strong></span>选择标识 <strong>注</strong>:前台页面将显示最新添加的一条信息</td>
</tr>
</table></td>
</tr>
</table>
<br>


<script language="javascript">
<!--

function check()
{
var f1=document.form1;
if(f1.news_type.value=="")
{
window.alert("系统提示:教材类别不能为空!");
return false;
}
if(f1.title.value=="")
{
window.alert("系统提示:教材标题不能为空!");
f1.title.focus();
return false;
}
if(f1.content.value=="")
{
window.alert("系统提示:信息详细内容不能为空!");
return false;
}

}

//-->
</script>



<table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC" class="t1">
<form name="form1" method="POST" action="save_news.asp" onSubmit="return check();" enctype="multipart/form-data">
<tr>

<td width="20%" height="30" align="right" bgcolor="#F4F4F4">
<div align="right"> 教材类别:</div></td>

<td width="80%" height="30" colspan="2">
<select name="news_type" >
<%call dlist("jcdg_type","id","type","")%>
</select>
<strong><span class="font4"><font color="#FF0000"> * </font></span></strong>
<div align="right"></div></td>
</tr>
<tr >
<td height="28" align="right" bgcolor="#F4F4F4"><div align="right"> 标题:</div></td>
<td height="28" align="left" colspan="2"><input type="text" name="title" size="60"> <strong><font color="#FF0000">* </font></strong>
</td>
</tr>
<tr >
<td height="28" align="right" bgcolor="#F4F4F4"><div align="right"> 详细内容:</div></td>
<td height="28" align="left" colspan="2">[<a href="#" onClick="to_edit('form1','title','content');return false;"><font color="#FF0000">编辑内容</font></a>] <strong><span class="font4"><font color="#FF0000"> * </font></span></strong>
</td>
</tr>
<tr style="display:none">
<td height="28" align="right" bgcolor="#F4F4F4"> </td>
<td height="28" align="left" colspan="2"><input type="file" name="mpic"><textarea rows="1" cols="50" name="content" ></textarea></td>
</tr>
<tr>
<td height="30" colspan="3">
<input name="save1" type="submit" class="b-input" value="保 存" style="width:100px">
<input name="reset1" type="reset" class="b-input" value="清 除" style="width:100px"> </td>
</tr>
</form>
</table>



<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}

function to_edit(f,t,c){
MM_openBrWindow('../editer_mkj/editer.asp?f='+f+'&t='+t+'&c='+c,'to_edit','scrollbars=yes,resizable=yes,status=yes,width=565,height=480');
}
//-->
</script>



<!--#include file="../inc/bottom.asp" -->






save_news.asp





<!--#include FILE="../inc/conn.asp"-->
<!--#include file="../inc/chkpost.asp" -->
<!--#include file="inc/check_qx.asp" -->
<!--#include file="../inc/upload.asp"-->

<% Server.ScriptTimeout = 1200 %>
<%
on error resume next
dim upload,formpath,formname,picfile,filename,fileExt,fPath,i,pic(8)
formpath="../../UploadFile_newspic_by_mkj/"

dim news_type,title,content,mpic,istop,recorder,memo



set upload=new upload_5xSoft
news_type=upload.form("news_type")
istop=0
for each formname in upload.file

set picfile=upload.file("mpic")
fileExt=lcase(right(picfile.filename,4))
if fileEXT<>".gif" and fileEXT<>".jpg" and fileEXT<>".bmp" and fileEXT<>"" then
response.write "<font size=2>系统提示:小图格式不对! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&cstr(i)&fileExt
if picfile.FileSize>0 then
picfile.SaveAs Server.mappath(formpath&filename)
pic(0)=FileName
end if
set picfile=nothing
next
istop=upload.form("istop")
if istop="" or isempty(istop) then
istop=0
end if
memo=upload.form("memo")

title=upload.form("title")
content=upload.form("content")
set upload=nothing
recorder=session("admin_name")
savenews()

sub savenews()
dim rs,sql
set rs=server.CreateObject("adodb.recordset")
sql="select * from jcdg"
rs.open sql,conn,1,3
rs.addnew()
on error resume next
rs("news_type")=news_type
rs("title")=title
rs("content")=content
rs("recorder")=recorder
if err.number=0 then
rs.update
rs.close
set rs=nothing
%>
<script language="JavaScript">
<!--
alert('系统提示:添加教材成功!');
history.back();
//-->
</script>
<%
else

%>
<script language="JavaScript">
<!--
alert('系统提示:添加教材失败!');
history.back();
//-->
</script>
<%
end if
end sub
%>
...全文
1011 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
shenzhenNBA 2009-08-11
  • 打赏
  • 举报
回复
显示成功,数据库没有记录,这显然是不成功的,

检查数据库没有对应的记录,说明插入表记录不成功;
但是显示成功了,是不是你程序出错了呢?
toury 2009-08-11
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 zhanglixin1234567 的回复:]
哥哥,不对啊,没有错误,直接提示添加成功
[/Quote]
数据库所在的文件夹有写入、修改权限吗?
lingfeng179 2009-08-11
  • 打赏
  • 举报
回复
enctype="multipart/form-data"
zhanglixin1234567 2009-08-11
  • 打赏
  • 举报
回复
自己顶下
zhanglixin1234567 2009-08-11
  • 打赏
  • 举报
回复
哥哥,不对啊,没有错误,直接提示添加成功
Jearol 2009-08-11
  • 打赏
  • 举报
回复
把你的 on error resume next 去掉再运行下看看
肯定报错了

28,391

社区成员

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

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