标题:头疼的问题,附整段代码,请教大家
只看楼主
eournet
Rank: 2
等 级:论坛游民
帖 子:103
专家分:26
注 册:2010-5-22
结帖率:55.56%
已结贴  问题点数:20 回复次数:1 
头疼的问题,附整段代码,请教大家
错误类型:
ADODB.Recordset (0x800A0CC1)
在对应所需名称或序数的集合中,未找到项目。
/produit/produit_renwu.asp, 第 125 行(红色字体部分
<%
'[ZJXM_ZYGL] (C) 2007-2009 维护中心 Inc.
'$Id: producit_renwu.asp 2009-08-17 $

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 fla13="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")="ok" then
nowselldate=request("selldate")
nowbeizhu=request("beizhu")
nowid_login=request("id_login")
set rs_login=conn.execute("select * from login where id="&nowid_login)
nowid_gys=request("id_gys")
nowgys=""
set rs_gys=conn.execute("select * from gys where id="&nowid_gys)
if rs_gys.eof=false then nowgys=rs_gys("company")
nowbianhao=replace(replace(replace(replace(replace(replace(FormatDateTime(now(),0),":","")," ",""),"-",""),"/",""),"上午",""),"下午","")


totalshulian=0
totalprice=0
for x=1 to maxproduit
nowku=request("ku"&x)
set rs_ku=conn.execute("select * from ku where id="&nowku)
nowhuohao=request("huohao"&x)
nowshulian=request("shulian"&x)
nowprice=request("price"&x)
if nowprice="" then
  nowprice=0
end if
if nowhuohao<>"单击选择项目" and nowshulian<>"" then
set rs_produit=conn.execute("select * from produit where huohao='"&nowhuohao&"'")
set rs=server.createobject("ADODB.RecordSet")
sql="select * from produit where huohao='"&nowhuohao&"' and id_ku="&nowku
rs.open sql,conn,1,3
if rs.eof then
%>
<script language="javascript">
alert("<%=rs_ku("ku")%> 中没有项目 <%=rs_produit("title")%>!")
window.history.go(-1)
</script>
<%
  response.end
  exit for
elseif rs("shulian")-nowshulian<0 then
%>
<script language="javascript">
alert("<%=rs_ku("ku")%> 中 <%=rs_produit("title")%> 库存不足!")
window.history.go(-1)
</script>
<%
  response.end
  exit for
end if
end if
next


totalshulian=0
totalprice=0

for x=1 to maxproduit
nowku=request("ku"&x)
set rs_ku=conn.execute("select * from ku where id="&nowku)
nowhuohao=request("huohao"&x)
nowshulian=request("shulian"&x)
nowprice=request("price"&x)
if nowprice="" then
  nowprice=0
end if
if nowhuohao<>"单击选择项目" and nowshulian<>"" then
aaa=aaa+1
set rs_produit=conn.execute("select * from produit where huohao='"&nowhuohao&"'")
set rs=server.createobject("ADODB.RecordSet")
sql="select * from produit where huohao='"&nowhuohao&"' and id_ku="&nowku
rs.open sql,conn,1,3
rs("id_danwei")=108
rs("id_login")=nowid_login
rs.update
rs.close
sql="select bigclass from bigclass where id="&rs_produit("id_bigclass")
set rs_bigclass=conn.execute(sql)
sql="select smallclass from smallclass where id="&rs_produit("id_smallclass")
set rs_smallclass=conn.execute(sql)
if rs_smallclass.eof then
  smallclass=""
else
  smallclass=rs_smallclass(0)
end if
totalshulian=totalshulian+nowshulian
totalprice=totalprice+nowprice*nowshulian
sql="insert into buy(id_produit,bigclass,smallclass,title,huohao,id_ku,ku,shulian,guige,id_login,login,type,selldate,price2,photo,id_gys,gys,bianhao,beizhu) values("&rs_produit("id")&",'"&rs_bigclass(0)&"','"&smallclass&"','"&rs_produit("title")&"','"&rs_produit("huohao")&"',"&rs_produit("id_ku")&",'"&rs_produit("ku")&"',"&rs_produit("shulian")&",'"&rs_produit("nowguige")&"',"&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&rs_produit("price2")&",'"&rs_produit("photo")&"',"&nowid_gys&",'"&nowgys&"','"&nowbianhao&"','"&nowbeizhu&"')"
conn.execute(sql)
end if
next
sql="insert into buy(id_produit,shulian,id_login,login,title,huohao,type,selldate,price2,id_gys,gys,bianhao,zu) values("&rs_produit("id")&","&rs_produit("shulian")&","&nowid_login&",'"&rs_login("username")&"','"&rs_produit("title")&"','"&rs_produit("huohao")&"',0,#"&date()&"#,"&rs_produit("price2")&","&nowid_gys&",'"&nowgys&"','"&nowbianhao&"',true)"
conn.execute(sql)

%>
<script language="javascript">
alert("项目任务领取成功,请及时进行GIS数据录入!")
</script>
<script language="javascript">
window.location.href="piliang.asp"
</script>
<%
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 check1()
{
if (document.form1.huohao1.value=="单击选择项目")
{
alert("还没有选择项目!");
return false;
}
if (document.form1.shulian1.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"> </td>
    </tr>
  </table>
</td>
<td>
<img src="../../../../../../../../../../../../../../../../../../../../../../../../../../../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
      <form name="form1" method="post">
      <tr>
        <td width="16%" align="right" height="30">请选择项目:</td>
        <td width="81%" class="category">
          <table cellpadding="0" cellspacing="0" width="100%" border=0>
            <%for x=1 to maxproduit%>
            <tr id="cailiaohan<%=x%>"<%if x<>1 then%> style="display:none;"<%end if%>>
              <td>
                <input name="huohao<%=x%>" readonly onClick="JavaScript:window.open('produit4.asp?form=form1&field=huohao<%=x%>&field2=price<%=x%>&span1=showshulian<%=x%>','','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=853,height=470,top=176,left=161');" style="width:80px" value="单击选择项目" size="1">
                数量: <input type="text" name="shulian<%=x%>" style="width:30px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" value="1">
                工日: <input type="text" name="price<%=x%>" style="width:30px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
                <%
                if request.Cookies("shiwei_id")="1" or fla88="1" then
                  sql="select * from ku order by id"
                  set rs_ku=conn.execute(sql)
                else
                  sql="select * from ku where instr(login,',"&request.Cookies("shiwei_id")&",')>0 order by id"
                  set rs_ku=conn.execute(sql)      
                end if
                if rs_ku.eof then
                %>
                <script language="javascript">
                  alert("没有对口施工单位!")
                  window.location.href="../system/ku_add.asp"
                </script>
                <%
                response.end
                end if
                %>
                施工单位: <select name="ku<%=x%>">
                <%
                do while rs_ku.eof=false
                %>
                  <option value="<%=rs_ku("id")%>"<%if rs_ku("moren") then%> selected="selected"<%end if%>><%=rs_ku("ku")%></option>
                <%
                  rs_ku.movenext
                loop
                %>
                </select>                                
                <%if x<>maxproduit then%><span onClick="cailiaohan<%=(x+1)%>.style.display=''" style="cursor:hand;">添加一个项目</span><%end if%>
                <%if x<>1 then%><input type="button" value="清除" onClick="huohao<%=x%>.value='单击选择项目';shulian<%=x%>.value='1';price<%=x%>.value=''" class="button"><%end if%>
                <%if x=1 then%><font color="#ff0000">*</font><%end if%>
                <div id="showshulian<%=x%>"></div>
              </td>
            </tr>        
            <%next%>        
          </table>
        </td>
      </tr>      
      <tr>
        <td align="right" height="30">项目管理员:</td>
        <td class="category">
                <%
                sql="select * from gys order by id"
                set rs_gys=conn.execute(sql)
                %>
                <select name="id_gys">
                  <option value="118">陆阿明</option>
                <%
                do while rs_gys.eof=false
                %>
                  <option value="<%=rs_gys("id")%>"><%=rs_gys("company")%></option>
                <%
                  rs_gys.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="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('day.asp?form=form1&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');">
        </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="100" rows="10">本项目任务已经领取,项目状态转入在录状态</textarea>
        </td>
      </tr>   
      <tr>
        <td height="30"> </td>
        <td class="category">
          <input type="submit" value="确认领取任务" onClick="return check1()" class="button">
          <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>
</body>
</html>
搜索更多相关主题的帖子: javascript 
2011-01-09 23:51
lele2007
Rank: 5Rank: 5
来 自:广东省深圳
等 级:职业侠客
威 望:6
帖 子:1028
专家分:305
注 册:2007-9-4
得分:20 
这个表:produit  里的字段
values("&rs_produit("id")&",'"&rs_bigclass(0)&"','"&smallclass&"','"&rs_produit("title")&"','"&rs_produit("huohao")&"',"&rs_produit("id_ku")&",'"&rs_produit("ku")&"',"&rs_produit("shulian")&",'"&rs_produit("nowguige")&"',"&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&rs_produit("price2")&",'"&rs_produit("photo")&"',"&nowid_gys&",'"&nowgys&"','"&nowbianhao&"','"&nowbeizhu&"')"

这里的rs_produit("") 括号之间引起的。。字段名,可能与表里的字段名字不对应。。最好检查对比一下。

bigclass  这个表里的。。rs_bigclass(0)  这个0取第一个。也尝试直接换成字段名字试一下。

这个错误提示一般是rs()里面的字段名字与数据表里的不对应导致的。吧

学习编程www.
2011-01-10 10:55



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




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

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