标题:部分数据写不进数据库
只看楼主
我郁闷
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-4-3
 问题点数:0 回复次数:2 
部分数据写不进数据库
本人是个小白,前几天从网上down了一个ASP+ACCESS的留言板程序下来,后来看他里面的功能太少,于是乎想着再添点内容。。。
   但是我自己添加的那部分,却没法写入数据库,而以前的一些却可以,请问这是为什么??

======== 你们不能这么对待新人啊,555555555,都无人问津呢呀,这个问题困扰了我一周多星期了呀,至少也帮我看看我下面代码里面什么地方有错啊。。。。。。。。。。。。

[[it] 本帖最后由 我郁闷 于 2008-4-3 12:01 编辑 [/it]]
搜索更多相关主题的帖子: 数据库 ASP ACCESS down 困扰 
2008-04-03 11:03
我郁闷
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-4-3
得分:0 
下面的是部分代码,请大大们帮我看一下,是哪儿出了问题。。。

            下面这个是提交数据的
Select Case action

Case "add"
'判断是否外部提交
dim From_url,Serv_url
From_url = Cstr(Request.ServerVariables("HTTP_Referer"))
Serv_url = Cstr(Request.ServerVariables("Server_Name"))
If mid(From_url,8,len(Serv_url)) <> Serv_url Then
    Response.Write "<script>alert('警告!\n\你正在从外部提交数据!!\n\请立即终止!!');this.location.href='"&Url&"';</SCRIPT>"
    Response.End
End If
'提交数据
 mingzi1=htmlencode(request.Form("mingzi"))
 biaoti1=htmlencode(request.Form("biaoti"))
 lanmu1=htmlencode(request.Form("lanmu"))
 email1=htmlencode(request.Form("email"))
 QQ1=htmlencode(request.From("QQ"))
 touxiang1=request.From("touxiang")
 biaoqing1=request.From("biaoqing")
 diqu1=request.From("diqu")
 show1=htmlencode(request.Form("show"))
 neirong1=Server.HTMLEncode(request.form("neirong"))

    Set mRs= Server.CreateObject("adodb.recordSet")
    mRs.open "Select * from www", conn, 1, 3
    mRs.addnew
        mRs("mingzi") = mingzi1
        mRs("biaoti") = biaoti1
        mRs("neirong") = neirong1
        mRs("lanmu") = lanmu1
        mRs("zhiding") = 0
        mRs("shijian") = now()
        mRs("email")= email1
        mRs("QQ")= QQ1
        mRs("touxiang")= touxiang1
        mRs("biaoqing")= biaoqing1
        mRs("diqu")= diqu1
        UserIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
        If UserIP = "" Then userip = Request.ServerVariables("REMOTE_ADDR")
        mRs("ip") = UserIP
    mRs.update
    mRs.close
    Set mRs = nothing
        Response.Write "<script>alert('留言添加成功\n\请记住我们的地址:www.');this.location.href='"&Url&"';</SCRIPT>"
        Response.End

         下面这个是提交表单:

    <form name="form1" id="form1" method="post" action="<%=Url%>&action=add" onsubmit=return(CheckInput())>
                                <table width="96%"  border="0" align="center" cellpadding="0" cellspacing="0" class="xixian">
                                  <tr>
                                    <td width="57" height="30"><div align="center" class="STYLE7" style="color: #000000">
                                              <div align="center">昵称:</div>
                                    </div>
                                    </div></td>
                                    <td width="101" height="30" class="xixian"><div align="left">
                                       <input name="mingzi" type="text" id="mingzi" onFocus="if(this.value=='猪') {this.value='';}this.style.color='#333';" onBlur="if(this.value=='') {this.value='猪';this.style.color='#ccc';}" value="猪" size="10" />
                                       <span style="color: #FF0000"><strong>*</strong></span></div></td>
                                    <td width="89" height="30"><div align="center" class="STYLE7">email:</div></td>
                                    <td height="30" colspan="3" class="xixian"><div align="left">
                                      <input name="email" type="text" id="biaoti" size="36" />
                                      <span class="STYLE5">*</span>
                                    </div></td>
                                    <td width="158" rowspan="6" class="xixian"><div align="center"><input name="Submit" type="image" value="提交" src="images/fa.jpg" align="middle" width="114" height="111">
                                    </div></td>
                                  </tr>
                                  <tr>
                                    <td height="31" class="xixian"><div align="center" class="STYLE7">
                                      <div align="center">QQ:</div>
                                    </div></td>
                                    <td class="xixian"><input name="qq" type="text" id="qq" size="10" /></td>
                                    <td width="89" class="xixian"><div align="center" class="STYLE7">来自哪里:</div></td>
                                    <td colspan="3" class="xixian"><select name="diqu" id="select" onChange="backwav.src='facechange.wav';">
                                      <option value="火星" selected>火星</option>
                                      <option value="北京">北京</option>
                                      <option value="上海">上海</option>
                                      <option value="天津">天津</option>
                                      <option value="重庆">重庆</option>
                                      <option value="河北">河北</option>
                                      <option value="山西">山西</option>
                                      <option value="内蒙古">内蒙古</option>
                                      <option value="辽宁">辽宁</option>
                                      <option value="吉林">吉林</option>
                                      <option value="黑龙江">黑龙江</option>
                                      <option value="江苏">江苏</option>
                                      <option value="浙江">浙江</option>
                                      <option value="安徽">安徽</option>
                                      <option value="福建">福建</option>
                                      <option value="江西">江西</option>
                                      <option value="山东">山东</option>
                                      <option value="河南">河南</option>
                                      <option value="湖北">湖北</option>
                                      <option value="湖南">湖南</option>
                                      <option value="广东">广东</option>
                                      <option value="广西">广西</option>
                                      <option value="海南">海南</option>
                                      <option value="四川">四川</option>
                                      <option value="贵州">贵州</option>
                                      <option value="云南">云南</option>
                                      <option value="西藏">西藏</option>
                                      <option value="陕西">陕西</option>
                                      <option value="甘肃">甘肃</option>
                                      <option value="宁夏">宁夏</option>
                                      <option value="青海">青海</option>
                                      <option value="新疆">新疆</option>
                                      <option value="香港">香港</option>
                                      <option value="澳门">澳门</option>
                                      <option value="台湾">台湾</option>
                                      <option value="海外">海外</option>
                                    </select></td>
                                    </tr>
                                 
                                  <tr>
                                    <td height="49" class="xixian" ><div align="center" class="STYLE7">
                                      <div align="center">表情:</div>
                                    </div></td>
                                    <td align="center" valign="middle" ><p align="center">
                                      <select name="biaoqing" id="select1" onChange="document.images['biaoqing1'].src=options[selectedIndex].value;backwav.src='facechange.wav';">
                                        <option value="touxiang/pp/pp.gif" selected>NO.01</option>
                                        <option value="touxiang/pp/pp(1).gif">NO.02</option>
                                        <option value="touxiang/pp/pp(2).gif">NO.03</option>                           </select><br>
                                      表情列表</p>                                      </td>
                                    <td ><div align="center"><img src="" width="32" height="32" alt=""></div></td>
                                    <td width="69" class="xixian"><div align="center">
                                      <div align="center" class="STYLE7">头像:</div>
                                    </div></td>
                                    <td width="125" align="center" valign="middle" ><p>
                                      <select name="touxiang" onChange="document.images['touxiang1'].src=options[selectedIndex].value;backwav.src='facehange.wav';">
                                        <option value="touxiang/pp/pp.gif" selected>NO.01</option>
                                        <option value="touxiang/pp/pp (1).gif">NO.02</option>
                                                  </select><br>
                                    <a href="touxiang.htm" style="color: #FF6633">头像列表</a><a href="touxiang.htm"></a> </p>                                      </td>
                                    <td width="75" ><div align="center"><img src="touxiang/pp/pp (8).gif" name="touxiang1" width="60" height="60" id="touxiang1"></div></td>
                                  </tr>
                                  <tr>
                                    <td height="30" class="xixian"><div align="center" class="STYLE7">
                                      <div align="center">性质:</div>
                                    </div></td>
                                    <td colspan="5" align="left" valign="middle" class="xixian"><font color="#000000">
                                      <input name="show" type="radio" value="0" checked>
                                      <span class="STYLE13">                                    公开</span>
                                    <input type="radio" name="show" value="1">
                                    <span class="STYLE13">悄悄话</span></font></td>
                                  </tr>
                                  <tr>
                                    <td height="25" class="xixian"><div align="center" class="STYLE7">
                                      <div align="center">标题:</div>
                                    </div></td>
                                    <td colspan="5"><div align="left">
                                      <input name="biaoti" type="text" id="biaoti" size="36" />
                                    </div></td>
                                  </tr>
                                  <tr>
                                    <td><div align="center">
                                      <div align="left" class="STYLE7" style="color: #000000">
                                        <div align="center">内容:</div>
                                      </div>
                                    </div></td>
                                    <td colspan="5" class="xixian"><div align="left">
                                      <textarea name="neirong" cols="60" rows="6" id="neirong"></textarea>
                                    </div></td>
                                    </tr>
                                </table>
                              </form>

  现在的问题是,我DOWN下来的程序和数据库里面以前就只有mingzi,biaoti和neirong三个字段,后来我想让他变得丰富一点,就自己建立了个数据库,添加了email,QQ,biaoqing,touxiang,show等几个字段,可是现在却只有他以前的那三个字段及我后面添加的email的值能成功写进数据库,而其他的却都不行。。
  请问大大,这是为什么??
2008-04-03 11:20
我郁闷
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-4-3
得分:0 
怎么还没人来帮我看啊。。。。。。
2008-04-04 09:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-206918-1-1.html




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

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