| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1208 人关注过本帖
标题:为什么添加后台数据没有变化?
只看楼主 加入收藏
冰雪飘飘
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2008-4-3
收藏
 问题点数:0 回复次数:9 
为什么添加后台数据没有变化?
数据库中有一表feedback,其中recorder、backtime等是字段,想添加记录,
虽然能显示添加成功,但是后台数据没有变化,还有一个奇怪的现象,就是在删除一个已经后,再添加,偶而有能成功添加,我是一个新手,请个为老师多多请教!添加程序asp代码如下:
<%
IF Request.Form("action")="添加" Then
        Frecorder=trim(request("recorder"))
        Fbacktime=trim(request("backtime"))
        Fproduct=trim(request("product"))
        Fuser_name=trim(request("user_name"))
        Fpeople=trim(request("people"))
        Fcontent=trim(request("content"))
        Fhandle=trim(request("handle"))
        Fresult=trim(request("result"))
        set rsF=server.createobject("adodb.recordset")
        sqltext="select * from [feedback]"
        rsF.open sqltext,conn,3,3

    '添加一条记录到数据库
        rsF.addnew
        rsF("recorder")=Frecorder
        rsF("backtime")=Fbacktime
        rsF("product")=Fproduct
        rsF("user_name")=Fuser_name
        rsF("people")=Fpeople
        rsF("content")=Fcontent
        rsF("handle")=Fhandle
        rsF("result")=Fresult
        rsF.update
        rsF.close
        conn.close
        response.write "<script language=JavaScript>{window.alert('此信息添加成功!');opener.parent.right.location.href='Feedback.asp';window.close();}</script>"
        response.end

    
End If
%>
搜索更多相关主题的帖子: 台数据 数据库 trim request 
2008-04-24 10:29
gaojing_abc
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2008-4-17
收藏
得分:0 
条件语句是想判断什么?
可能是IF语句的问题。
2008-04-24 11:33
冰雪飘飘
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2008-4-3
收藏
得分:0 
这是整个添加程序段:
<!--#include file="conn.asp"-->
<SCRIPT language=javascript>
function form4_onsubmit()
{
if(document.FORM4.recorder.value.length<1)
 {
   alert("经手人不能为空!");
   document.FORM4.recorder.focus();
   return false;
  }
   if(document.FORM4.content.value.length<1)
 {
   alert("反馈内容不能为空!");
   document.FORM4.content.focus();
   return false;
 }
}
</SCRIPT>
<%
IF Request.Form("action")="添加" Then
        Frecorder=trim(request("recorder"))
        Fbacktime=trim(request("backtime"))
        Fproduct=trim(request("product"))
        Fuser_name=trim(request("user_name"))
        Fpeople=trim(request("people"))
        Fcontent=trim(request("content"))
        Fhandle=trim(request("handle"))
        Fresult=trim(request("result"))
        set rsF=server.createobject("adodb.recordset")
        sqltext="select * from [feedback]"
        rsF.open sqltext,conn,3,3

    '添加一条记录到数据库
        rsF.addnew
        rsF("recorder")=Frecorder
        rsF("backtime")=Fbacktime
        rsF("product")=Fproduct
        rsF("user_name")=Fuser_name
        rsF("people")=Fpeople
        rsF("content")=Fcontent
        rsF("handle")=Fhandle
        rsF("result")=Fresult
        rsF.update
        rsF.close
        conn.close
        response.write "<script language=JavaScript>{window.alert('此信息添加成功!');opener.parent.right.location.href='Feedback.asp';window.close();}</script>"
        response.end

    
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="Styles.css">
<title>添加反馈信息</title>
</head>
<body oncontextmenu=self.event.returnValue=false>

<form method="POST" action="Feedback_Add.asp" name='FORM4' onSubmit="return form4_onsubmit()">
<table border="1" cellpadding="0" width="100%" bordercolorlight="#A8CBF1" bordercolordark="#FFFFFF" cellspacing="0" height="66">
<tr>
<td colspan="2" bgcolor="#A8CBF1" height="30" align="center"><font size=3><b>添加反馈信息</font></b></td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#E9F4FF" align="right">经手人:</td>
<td width="71%" bgcolor="#E9F4FF">
<input type="text" name="recorder" size="20">
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#E9F4FF" align="right">反馈日期:</td>
<td width="71%" bgcolor="#E9F4FF">
<input name="backtime" type="text"size="20">
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#E9F4FF" align="right">相关产品:</td>
<td width="71%" bgcolor="#E9F4FF">
<input name="product" type="text"  size="20">
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#E9F4FF" align="right">相关客户:</td>
<td width="71%" bgcolor="#E9F4FF">
<input name="user_name" type="text" size="20">
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#E9F4FF" align="right">相关联系人:</td>
<td width="71%" bgcolor="#E9F4FF">
<input name="people" type="text"  size="20">
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#E9F4FF" align="right">反馈内容:</td>
<td width="71%" bgcolor="#E9F4FF">
  <input name="content" type="text" value="" size="20">
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#E9F4FF" align="right">处理人员:</td>
<td width="71%" bgcolor="#E9F4FF">
  <input name="handle" type="text" value="" size="20">
</td>
</tr>
<tr>
<td width="32%" height="30" bgcolor="#E9F4FF" align="right">处理结果:</td>
<td width="71%" bgcolor="#E9F4FF">
  <input name="result" type="text" value="" size="20">
</td>
</tr>
<tr>
<td height="30" bgcolor="#E9F4FF" colspan="2" align="center">
<p align="center"><input class=button1 type="submit" value="添加" name="action">
  <INPUT class=button1 onclick=javascript:window.close() type=button value=关闭></p>
</td>
</tr>
</table></form>
</body>
</html>
2008-04-24 13:09
ysm140
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2008-3-27
收藏
得分:0 
<form method="POST" action="Feedback_Add.asp" name='FORM4' onSubmit="return form4_onsubmit()">
改成
<form method="POST" action="Feedback_Add.asp?action=添加" name='FORM4' onSubmit="return form4_onsubmit()">
2008-04-24 13:39
冰雪飘飘
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2008-4-3
收藏
得分:0 
不行啊!我也曾那样改过,可是改后连"此信息添加成功!"都没有显示了,窗口也没有关闭.
真是急死人了,为什么在这就不能实现呢?
2008-04-24 14:37
feelingxj
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2008-4-23
收藏
得分:0 
rsF.open sqltext,conn,1,3试试
2008-04-25 00:16
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
因为这句话
IF Request.Form("action")="添加" then
有问题
2008-04-25 00:39
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
<p align="center"><input class=button1 type="submit" value="添加" name="submit"><input type="hidden" value="添加" name="action" />
  <INPUT class=button1 onclick=javascript:window.close() type=button value=关闭></p>


试试这个
2008-04-25 07:47
fengmumei
Rank: 2
等 级:论坛游民
威 望:2
帖 子:298
专家分:14
注 册:2006-9-16
收藏
得分:0 
action="Feedback_Add.asp"中的“Feedback_Add.asp”就是你发上来的那段代码?

随缘不变,不变随缘
2008-04-26 17:05
冰雪飘飘
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2008-4-3
收藏
得分:0 
问题已经解决.真的麻烦各位了,谢谢你们!
我数据库设计有问题,真的很不好意思,我也是后面才发现的
2008-04-26 22:59
快速回复:为什么添加后台数据没有变化?
数据加载中...
 
   



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

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