| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4136 人关注过本帖
标题:请教一个错误,弄了几天也没有明白
只看楼主 加入收藏
eournet
Rank: 2
等 级:论坛游民
帖 子:103
专家分:26
注 册:2010-5-22
结帖率:55.56%
收藏
 问题点数:0 回复次数:9 
请教一个错误,弄了几天也没有明白
<%

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 fla70="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("hid2")="" then%>

<form name="form1">
<%
nowtype=request("type")
if nowtype="" then  nowtype=0
%>
<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"></td>
    </tr>
  </table>
</td>
<td>
<img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<form name="form5">

<%
sql="select * from caiwupj  where id="&request("id")
set rs=conn.execute(sql)
%>

<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
      
      <tr>
        <td width="20%" height="30"  align="right">关联项目编号:</td>
        <td width="80%" class="category">
        <font color="#FF0000">
                <input name="huohao"  style="width:250px"   value="<%=rs("huohao")%>" size="1"></font></td>
      </tr>   
      <tr>
        <td width="20%" height="30" align="right">关联项目名称:</td>
        <td width="80%" class="category">
        <font color="#FF0000">
                <input  name="kemumc" style="width:250; height:18" value="<%=("title")%>" size="1"></font></td>
      </tr>   
      <tr>
        <td width="20%" height="30" align="right">类型:</td>
        <td width="80%" class="category">
        <select name="type" onChange="form1.submit()">
          <option value="0"<%if nowtype="0" then%> selected="selected"<%end if%>>收入</option>
          <option value="1"<%if nowtype="1" then%> selected="selected"<%end if%>>支出</option>
        </select>        </td>
      </tr>   
      </form>
      <form name="form2">
      <input type="hidden" name="type" value="<%=nowtype%>">
      <tr>
        <td align="right" height="30">所属大类:</td>
        <td class="category">
    <%
    sql="select * from money_bigclass where type="&nowtype&" order by id"
    set rs_bigclass=conn.execute(sql)
    if rs_bigclass.eof then
    %>
    <script language="javascript">
      alert("请先添加帐务大类!")
      window.location.href="../money/bigclass_add.asp"
    </script>
    <%
      response.end
    end if
    nowbigclass=request("bigclass")
    if nowbigclass="" then
      nowbigclass=rs_bigclass("id")
    end if
    %>
      <select name="bigclass" onChange="form2.submit()">
        <%
    do while rs_bigclass.eof=false
    %>
        <option value="<%=rs_bigclass("id")%>"<%if trim(cstr(rs_bigclass("id")))=nowbigclass then%> selected="selected"<%end if%>><%=rs_bigclass("bigclass")%></option>
        <%
      rs_bigclass.movenext
    loop
    %>
      </select>         
          </td>
      </tr>   
      </form>
      <form name="form3">
      <input type="hidden" name="bigclass" value="<%=nowbigclass%>">
      <input type="hidden" name="type" value="<%=nowtype%>">
      <tr>
        <td align="right" height="30">所属小类:</td>
        <td class="category">
    <%
    sql="select * from money_smallclass where id_bigclass="&nowbigclass&" order by id"
    set rs_smallclass=conn.execute(sql)
    %>
      <select name="smallclass">
        <option value="0"></option>
        <%
    do while rs_smallclass.eof=false
    %>
        <option value="<%=rs_smallclass("id")%>"<%if trim(cstr(rs_smallclass("id")))=nowsmallclass then%> selected="selected"<%end if%>><%=rs_smallclass("smallclass")%></option>
        <%
      rs_smallclass.movenext
    loop
    %>
      </select>  
          </td>
      </tr>  
      <tr>
        <td align="right" height="30">金额:</td>
        <td class="category">
        <input type="text" name="price" style="width:100px"  value="<%=("hj")%>" size="1">
          <font color="#666666">元</font>
          <font color="#ff0000">*</font>
        </td>
      </tr>   
      <tr>
        <td align="right" height="30">银行:</td>
        <td class="category">
                <select name="bank" size="1">
                  <option value="1">选择银行</option>
                <%
                sql="select * from bank order by id"
                set rs_bank=conn.execute(sql)
                do while rs_bank.eof=false
                %>
                  <option value="<%=rs_bank("id")%>"<%if rs_bank("moren") then%> selected="selected"<%end if%>><%=rs_bank("bank")%></option>
                <%
                  rs_bank.movenext
                loop
                %>
                </select>
        </td>
      </tr>
      <tr>
        <td align="right" height="30">时间:</td>
        <td class="category">
          <input name="selldate" value="<%=date()%>" readonly style="width:150px">
          <img src="../images/date.gif" align="middle" style="cursor:pointer;" onClick="JavaScript:window.open('day.asp?form=form3&field=selldate&oldDate='+selldate.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=200,left=520');" width="23" height="22">
        </td>
      </tr>   
      <tr>
        <td align="right" height="30">经办人:</td>
        <td class="category">
          <%
          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 rs_login("username")=request.Cookies("shiwei_username") 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">
          <textarea name="beizhu" cols="60" rows="3"><%=("title")%></textarea>
        </td>
      </tr>            
      <tr>
        <td height="30"> </td>
        <td class="category">
          <input type="submit" value=" 确认添加 " onClick="return check()" class="button">&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="hidden" name="hid2" 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>
</form>

<%
else
ranNum=int(1*rnd)+3
iddata=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
nowselldate=request("selldate")
nowtype=request("type")
nowbigclass=request("bigclass")
nowsmallclass=request("smallclass")
nowtitle=request("title")
nowkemumc=request("kemumc")
nowhuohao=request("huohao")
nowtype=request("type")
nowname=request.Cookies("shiwei_username")
nowprice=request("price")
if nowprice="" then
  nowprice=0
end if
nowbank=request("bank")
nowbeizhu=request("beizhu")
nowid_login=request("id_login")
if nowtype=0 then
nowbianhao="S-"&iddata
end if
if nowtype=1 then
nowbianhao="Z-"&iddata
end if
'sql="select * from shiwei_money where  1=2"
'set rs=conn.execute(sql)
'if rs.eof=false then
%>

<%
 ' response.end
'end if

sql="select * from [shiwei_money]"
set rs = server.createobject("ADODB.RecordSet")
rs.open sql,conn,1,3
rs.addnew
rs("kemumc")=request("kemumc")
rs("price")=nowprice
rs("liushui")=nowbianhao
rs("id_bigclass")=nowbigclass
rs("id_smallclass")=nowsmallclass
rs("type")=nowtype
rs("beizhu")=nowbeizhu
rs("login")=nowname
rs("selldate")=nowselldate
rs("id_bank")=nowbank
rs.update
rs.close
set rs=nothing
%>


<script language="javascript">
alert("操作成功!")
window.location.href="caiwu_xmkp.asp"
</script>
<%
'response.end
end if
%>
<script language="javascript">
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
    TempChar= InString.substring (Count, Count+1);
    if (RefString.indexOf (TempChar, 0)==-1)  
    return (false);
}
return (true);
}

function check()
{
if (document.form3.price.value=="")
{
alert("有*号的必须填写!");
return false;
}
if (isNumberString(document.form3.price.value,"1234567890.")!=1)
{
alert("金额只能为数字!");
return false;
}
}
</script>


</body>
</html>
2016-11-24 13:37
eournet
Rank: 2
等 级:论坛游民
帖 子:103
专家分:26
注 册:2010-5-22
收藏
得分:0 
页面显示正常,但是在选择类型的时候页面就出错:(72行就是红色部分,请教大神解决下,谢谢!)

错误类型:
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'id=' 中。
/produit/caiwu_zw.asp, 第 72 行
2016-11-24 13:39
eournet
Rank: 2
等 级:论坛游民
帖 子:103
专家分:26
注 册:2010-5-22
收藏
得分:0 
我不太明白的就是选择类型的时候跟这个有什么关联,72行市为了引入RS数据:value="<%=rs("huohao")%>"
2016-11-24 13:41
eournet
Rank: 2
等 级:论坛游民
帖 子:103
专家分:26
注 册:2010-5-22
收藏
得分:0 
怎么这么冷清,半天也没有人理睬
2016-11-24 19:49
eournet
Rank: 2
等 级:论坛游民
帖 子:103
专家分:26
注 册:2010-5-22
收藏
得分:0 
发布了这么长时间的问题,居然无人问津,这个网站人气是够呛
2016-11-25 13:47
shuai9201
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2017-2-9
收藏
得分:0 
你的ID格式不对
2017-02-09 17:00
lsmmh
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2017-5-31
收藏
得分:0 
不是人少,是愿意帮忙的高人太少了,唉,都是过路打酱油的
2017-06-25 17:50
ZHRXJR
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:125
帖 子:1034
专家分:5519
注 册:2016-5-10
收藏
得分:0 
回复 2楼 eournet
页面显示正常,但是在选择类型的时候页面就出错:(72行就是红色部分,请教大神解决下,谢谢!)

错误类型:
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'id=' 中。
/produit/caiwu_zw.asp, 第 72 行


问题非常清楚,操作符丢失,是 id 的操作符丢失,就是说,id 后面的值是空值。
大概看来一下你的代码,在72行前没有发现 id 的赋值语句,在72行以后有 <input name="huohao"  style="width:250px"   value="<%=rs("huohao")%>" size="1">
但这个文本框的名称不是 id ,而是 huohao ,也不对。
一般ASP脚本执行是从前向后,在72行前必须有<input name="id"  style="width:250px"   value="<%=rs("huohao")%>" size="1">,而且需要连接数据表,因为 <%=rs("huohao")%> 是读取数据表中的记录的。

请不要选我!!!
2017-07-09 13:07
LiaoDY945
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2019-3-16
收藏
得分:0 
程序执行到此处时,ID值要接收GET一个值,但此时无值传递,id赋值为空,报错!
应该,在按收ID后,对ID是否为空进行判断后,再执行!
2019-03-16 13:55
ke爱的小tu子
Rank: 2
等 级:论坛游民
帖 子:51
专家分:20
注 册:2021-2-11
收藏
得分:0 
多半是sql除了问题.
response.write sql
response.end
看看你的sql到底是个什么鬼,多半是sql那里有问题。
2021-02-11 13:47
快速回复:请教一个错误,弄了几天也没有明白
数据加载中...
 
   



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

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