| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 813 人关注过本帖
标题:ASP代码修改后提交数据出错,请高手指点!
只看楼主 加入收藏
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:13 
ASP代码,请高手指教!
我用的是友欧进销存ASP程序,以下是鄙人修改过的“添加业主”页面,提交出错:

Microsoft JET Database Engine 错误 '80040e14'
INSERT INTO 语句的语法错误。
/1/huiyuan/huiyuan_add.asp,行 233

源代码如下:=========================================
<%if request.Cookies("shiwei_username")="" then%>
<script language="javascript">top.location.href="../index.asp"</script>
<%  
  response.end
end if
%>
<!-- #include file="../conn2.asp" -->
<!-- #include file="../const.asp" -->

<html>
<head>
<title><%=dianming%> - 添加业主</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style>body { background-color:#FFFFFF; }</style>
</HEAD>

<BODY>
<%if fla35="0" and request.Cookies("shiwei_id")<>"1" then%>
<br><center><img src="../images/note.gif" align="absmiddle">&nbsp;<font color="#FF0000">你不具备此权限,请与管理员联系!</font></center>
<%  
  response.end
end if
%>
<%if request("hid1")="" then%>
<script language="javascript">
function check()
{
if (document.form2.username.value==""||document.form2.card.value=="")
{
alert("有*号的必须填写!");
return false;
}
}
</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr><td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;添加业主(带*号的为必填项)</td>
      <td align="right">&nbsp;</td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
 <tr>
  <td></td>
    <td><table width="83%" border="1" align="center" cellpadding="4" cellspacing="1" class="toptable grid">
      <form name="form2">
      <tr><td width="15%" height="30" align="right">所在小区:</td>
      <td width="85%" class="category">
      <%
    sql="select * from ku order by id"
    set rs_ku=conn.execute(sql)
    if rs_ku.eof then
    %>
    <script language="javascript">
    alert("请先添加小区!")
    window.location.href="../system/ku_add.asp"
    </script>
    <%   
    response.end
    end if
    nowku=request("ku")
    if nowku="" then
    nowku=rs_ku("id")
    end if
    %>
    <select name="ku" onChange="form2.submit()">
      <%do while rs_ku.eof=false%>
      <option value="<%=rs_ku("id")%>"<%if trim(cstr(rs_ku("id")))=nowku then%> selected="selected"<%end if%>><%=rs_ku("ku")%></option>
      <%
     rs_ku.movenext
    loop
    %>
      </select></td></tr>
</form>
<form name="form1">
    <input type="hidden" name="ku" value="<%=nowku%>">   
      <tr><td width="15%" height="30" align="right">楼宇单元:</td>
      <td width="85%" class="category">
      <%
    sql="select * from zu_huiyuan where ku="&nowku&" order by id"
    set rs_zu=conn.execute(sql)
    %>
    <select name="zu"><option value="0"></option>
      <%do while rs_zu.eof=false%>
      <option value="<%=rs_zu("id")%>"<%if trim(cstr(rs_zu("id")))=nowzu then%> selected="selected"<%end if%>><%=rs_zu("zu")%></option>
      <%
      rs_zu.movenext
    loop
    %>
      </select></td></tr>

    <tr><td align="right" height="30">房&nbsp;&nbsp;&nbsp;&nbsp;号:</td><td class="category"><input type="text" name="card" style="width:100px">&nbsp;<font color="#ff0000">*</font>
  &nbsp;&nbsp;&nbsp;业主姓名:<input type="text" name="username" style="width:120px">&nbsp;<font color="#ff0000">*</font>
  &nbsp;&nbsp;&nbsp;性别:<input type="radio" name="xinbie" value="男" checked="checked">&nbsp;男&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="xinbie" value="女">&nbsp;女</td></tr>
  <tr><td align="right" height="30">联系电话:</td><td class="category"><input type="text" name="tel" style="width:200px">    &nbsp;&nbsp;&nbsp;QQ:<input type="text" name="qq" style="width:110px" onKeyUp="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')">
  &nbsp;&nbsp;&nbsp;Email:<input type="text" name="email" style="width:150px"></td></tr>
  <tr><td align="right" height="30">地址:</td><td class="category"><input type="text" name="address" style="width:300px"></td></tr>
  <tr><td align="right" height="30">身份证号:</td><td class="category"><input type="text" name="sfz" style="width:300px"></td></tr>
  <tr><td align="right" height="30">介绍人:</td><td class="category"><input name="huiyuan2" readonly onClick="JavaScript:window.open('huiyuan.asp?form=form1&field=jieshao&field2=huiyuan2&field3=huiyuan3','','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=853,height=470,top=176,left=161');" style="width:90px" value="单击选择业主"><input type="text" name="huiyuan3" style="width:150px" readonly><input type="hidden" name="jieshao">
    &nbsp;&nbsp;经办人:
    <%
    if request.Cookies("shiwei_id")=1 then
    sql="select * from login order by id_zu,id"
    set rs_login=conn.execute(sql)
    else
    sql="select * from login where id="&request.Cookies("shiwei_id")
    set rs_login=conn.execute(sql)      
    end if
    if rs_login.eof then
    %>
    <script language="javascript">
    alert("请先添加员工!")
    window.location.href="../system/user_add.asp"
    </script>
    <%
    response.end
    else
    %>
<select name="id_login"><%do while rs_login.eof=false%><option value="<%=rs_login("id")%>"<%if trim(cstr(rs_login("id")))=trim(cstr(request.Cookies("shiwei_id"))) then%> selected="selected"<%end if%>><%=rs_login("username")%> (<%=rs_login("bianhao")%>)</option>
    <%
    rs_login.movenext
    loop
    %>
    </select>
<%end if%></td>
      </tr>   
      <tr><td align="right" height="30">入住时间:</td><td class="category"><input name="startdate" value="<%=date()%>" readonly style="width:100px"><img src="../images/date.gif" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('day.asp?form=form1&field=startdate&oldDate='+startdate.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=500,left=520');">
      &nbsp;&nbsp;&nbsp;业主生日:
       <select name="shenri1"><%for x=1930 to 2006%><option value="<%=x%>"<%if x=1970 then%> selected="selected"<%end if%>><%=x%></option><%next%></select>
       年<select name="shenri2"><%for x=1 to 12%><option value="<%=x%>"><%=x%></option><%next%></select>
       月<select name="shenri3"><%for x=1 to 31%><option value="<%=x%>"><%=x%></option><%next%></select>
       日&nbsp;<select name="yinyan"><option value="阴">阴历</option><option value="阳">阳历</option></select></td>
       </tr>
          <tr>
            <td align="right" height="30">费用起始日期:</td><td class="category">
            水&nbsp;&nbsp;&nbsp;费:
            <select name="shui1"><%for x=2010 to 2030%><option value="<%=x%>"<%if x=2010 then%> selected="selected"<%end if%>><%=x%></option><%next%></select>年
            <select name="shui2"><%for x=1 to 12%><option value="<%=x%>"><%=x%></option><%next%></select>月
            <select name="shui3"><%for x=1 to 31%><option value="<%=x%>"><%=x%></option><%next%></select>日
            &nbsp;&nbsp;电&nbsp;&nbsp;&nbsp;费:
            <select name="dian1"><%for x=2010 to 2030%><option value="<%=x%>"<%if x=2010 then%> selected="selected"<%end if%>><%=x%></option><%next%></select>年
            <select name="dian2"><%for x=1 to 12%><option value="<%=x%>"><%=x%></option><%next%></select>月
            <select name="dian3"><%for x=1 to 31%><option value="<%=x%>"><%=x%></option><%next%></select>日<br />
            物管费:
            <select name="wuye1"><%for x=2010 to 2030%><option value="<%=x%>"<%if x=2010 then%> selected="selected"<%end if%>><%=x%></option><%next%></select>年
            <select name="wuye2"><%for x=1 to 12%><option value="<%=x%>"><%=x%></option><%next%></select>月
            <select name="wuye3"><%for x=1 to 31%><option value="<%=x%>"><%=x%></option><%next%></select>日
            &nbsp;&nbsp;其他费:
            <select name="qita1"><%for x=2010 to 2030%><option value="<%=x%>"<%if x=2010 then%> selected="selected"<%end if%>><%=x%></option><%next%></select>年
            <select name="qita2"><%for x=1 to 12%><option value="<%=x%>"><%=x%></option><%next%></select>月
            <select name="qita3"><%for x=1 to 31%><option value="<%=x%>"><%=x%></option><%next%></select>日
          </td>
       </tr>
    <tr><td align="right" height="30">备注:</td><td class="category"><textarea name="beizhu" cols="70" rows="4"></textarea></td>
  </tr>      
<tr><td height="30">&nbsp;</td><td class="category"><input type="submit" value="确认添加" onClick="return check()" class="button">&nbsp;&nbsp;&nbsp;&nbsp;<input type="hidden" name="hid1" value="ok"><input type="reset" value="重新填写" class="button"></td></tr>
  </form>
</table>
</td>
<td></td>
</tr>
<tr><td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr></table>
<%
else
nowqq=request("qq")
nowemail=request("email")
nowid_zu=request("id_zu")
nowusername=request("username")
nowxinbie=request("xinbie")
nowtel=request("tel")
nowaddress=request("address")
nowsfz=request("sfz")
nowjieshao=request("jieshao")
nowcard=request("card")
nowid_login=request("id_login")
nowstartdate=request("startdate")
nowshenri1=request("shenri1")
nowshenri2=request("shenri2")
nowshenri3=request("shenri3")
nowyinyan=request("yinyan")
nowshenri=nowshenri1&"-"&nowshenri2&"-"&nowshenri3
nowenddate=cdate(nowstartdate)+365
nowbeizhu=request("beizhu")
nowku=request("ku")
nowshui1=request("shui1")
nowshui2=request("shui2")
nowshui3=request("shui3")
nowdian1=request("dian1")
nowdian2=request("dian2")
nowdian3=request("dian3")
nowwuye1=request("wuye1")
nowwuye2=request("wuye2")
nowwuye3=request("wuye3")
nowqita1=request("qita1")
nowqita2=request("qita2")
nowqita3=request("qita3")
nowshui=nowshui1&"-"&nowshui2&"-"&nowshui3
nowdian=nowdian1&"-"&nowdian2&"-"&nowdian3
nowwuye=nowwuye1&"-"&nowwuye2&"-"&nowwuye3
nowqita=nowqita1&"-"&nowqita2&"-"&nowqita3
sql="select * from huiyuan where card='"&nowcard&"'"
set rs=conn.execute(sql)
if rs.eof=false then
%>
<script language="javascript">
alert("您输入的业主房号已经存在,请重新输入!")
window.history.go(-1)
</script>
<%
  response.end
end if

if nowjieshao="" then
nowjieshao=0
else
  sql="update huiyuan set jifen=jifen+"&jieshaojifen&" where id="&nowjieshao
  conn.execute(sql)
end if

set rs_login=conn.execute("select * from login where id="&nowid_login)
nowlogin=rs_login("username")
sql="insert into huiyuan(username,xinbie,tel,address,sfz,jieshao,card,id_login,login,startdate,shenri,enddate,beizhu,yinyan,qq,email,id_zu,ku,shui,dian,wuye,qita) values('"&nowusername&"','"&nowxinbie&"','"&nowtel&"','"&nowaddress&"','"&nowsfz&"',"&nowjieshao&",'"&nowcard&"',"&nowid_login&",'"&nowlogin&"',#"&nowstartdate&"#,#"&nowshenri&"#,#"&nowenddate&"#,'"&nowbeizhu&"','"&nowyinyan&"','"&nowqq&"','"&nowemail&"',"&nowid_zu&","&nowku&",#"&nowshui&"#,#"&nowdian&"#,#"&nowwuye&"#,#"&nowqita&"#)"
conn.execute(sql)
%>
<script language="javascript">
alert("业主添加成功!")
window.location.href="huiyuan.asp"</script>
<%end if%>
</body></html>
================================结束
我是刚结束ASP不久,估计是“选择小区部分和form的问题(红色和蓝色部分),请各位师傅指点指点。

[ 本帖最后由 天蝎风 于 2010-11-8 00:54 编辑 ]
搜索更多相关主题的帖子: ASP 代码 指教 
2010-11-07 04:39
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:6 
233行是哪一行啊。

QQ:63572063
2010-11-07 13:44
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
收藏
得分:0 
以下是引用wangjy500在2010-11-7 13:44:28的发言:

233行是哪一行啊。
你好啊,是下半部分紫色那一行。但是我试过了,把这一段全撤掉也不行,还会推到上一行的错误。

南宁信息网http://www.
2010-11-08 00:57
hams
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:18
帖 子:912
专家分:3670
注 册:2008-7-30
收藏
得分:6 
把这句
conn.execute(sql)
改为
response.write sql

先看看会是什么结果

俺不高手,俺也是来学习的。
俺的意见不一定就对,当你不认同时请点忽视按钮。
当走到十字路口不知该如何走时,可在论坛问下路,但你若希望别人能一路把你送到目的地,显然是不现实的,因为别人也有自己要走的路。
2010-11-08 10:06
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
收藏
得分:0 
以下是引用hams在2010-11-8 10:06:40的发言:

把这句
conn.execute(sql)
改为
response.write sql

先看看会是什么结果
Microsoft VBScript 编译器错误 错误 '800a0401'

语句未结束

/1/huiyuan/huiyuan_add.asp,行 214

set rs=response.write sql
----------------------^

南宁信息网http://www.
2010-11-08 11:09
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
收藏
得分:0 
回复 5楼 天蝎风
应该是小区选择和楼宇选择中的代码问题,还有FROM表单,就这三个地方和整个代码对不上,就是看不懂哪里不对。

南宁信息网http://www.
2010-11-08 11:13
hams
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:18
帖 子:912
专家分:3670
注 册:2008-7-30
收藏
得分:0 
set rs=response.write sql
有这么写代码的么

sql="update huiyuan set jifen=jifen+"&jieshaojifen&" where id="&nowjieshao
  conn.execute(sql)
end if
改为
sql="update huiyuan set jifen=jifen+"&jieshaojifen&" where id="&nowjieshao
response.write sql
end if




……nowqita&"#)"
conn.execute(sql)
%>
改为
……nowqita&"#)"
response.write sql
%>
收到的鲜花
  • 天蝎风2010-11-08 13:14 送鲜花  2朵   附言:感谢

俺不高手,俺也是来学习的。
俺的意见不一定就对,当你不认同时请点忽视按钮。
当走到十字路口不知该如何走时,可在论坛问下路,但你若希望别人能一路把你送到目的地,显然是不现实的,因为别人也有自己要走的路。
2010-11-08 11:31
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
收藏
得分:0 
回复 7楼 hams
版主您好啊~我按照你的方法修改后提交出现以下情况:
图片附件: 游客没有浏览图片的权限,请 登录注册
点击查看大图
在业主列表显示资料,但不显示姓名和房号。
 

南宁信息网http://www.
2010-11-08 12:07
天蝎风
Rank: 1
来 自:广西
等 级:新手上路
帖 子:64
专家分:5
注 册:2010-11-7
收藏
得分:0 
求助啊~~各位大侠出来指点指点啊~~~~~~~~~~~~~~

南宁信息网http://www.
2010-11-08 16:41
hams
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:18
帖 子:912
专家分:3670
注 册:2008-7-30
收藏
得分:0 
图片看不清楚

俺不高手,俺也是来学习的。
俺的意见不一定就对,当你不认同时请点忽视按钮。
当走到十字路口不知该如何走时,可在论坛问下路,但你若希望别人能一路把你送到目的地,显然是不现实的,因为别人也有自己要走的路。
2010-11-09 08:13
快速回复:ASP代码修改后提交数据出错,请高手指点!
数据加载中...
 
   



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

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