高人帮忙解决:错误 '800a0cc1'

danielnie 2006-01-31 11:15:30
ADODB.Recordset 错误 '800a0cc1'
在对应所需名称或序数的集合中,未找到项目。

我用的郭新行写的sql分页存储过程,他是先调用一个存储过程生成一个临时的表,再调用另一个存储过程实现分布,调用后页面出现上面错误,sql查询分析器里显示消息为
(所影响的行数为 21 行)

(所影响的行数为 20 行)

我想可能是我语句先读了第一次的返回结果,最后返回的结果没有用到,请问这个问题怎么解决呢?
...全文
327 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
超级大笨狼 2006-02-01
  • 打赏
  • 举报
回复
存储过程返回多个结果集,在ASP里面不可以调用,.net可以
danielnie 2006-02-01
  • 打赏
  • 举报
回复
没有解决问题,感觉就是读到了第一个执行的结果集,第二个没读到
超级大笨狼 2006-02-01
  • 打赏
  • 举报
回复
在存储过程头部加上SET NOCOUNT ON

超级大笨狼 2006-02-01
  • 打赏
  • 举报
回复
Why do I get 800A0CC1 errors?

http://www.aspfaq.com/2275 created: 2002-04-15 last updated: 2002-08-18 21:34 this article is printer friendly
When working with a resultset in ASP and you do this:

<%
...
Response.Write(rs("columnName"))
%>


... you may get the following error:

ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.


... even though columnName is clearly being returned in the resultset when you run the procedure from Query Analyzer.

Sometimes this is because you've misspelled the column name, referred to an aggregate without using an alias (see Article #2159), referenced a column name that appears more than once in the SELECT list (e.g. a JOIN between two tables that have a common column), or even referenced the wrong resultset in the case of multiple resultsets. If you are having one of these problems, you can correct them quite easily by referencing the column correctly, or the correct recordset. If you have a JOIN that has two columns with the same name, you probably have a design issue because (a) if the columns contain the same value, you don't need both in the resultset; and (b) if the columns don't contain the same value, then they have different meanings, and therefore should have distinct names.

But most often it is because you're using a stored procedure, and ADO is incorrectly interpreting messages in QA's messages tab, for example:

1 row(s) affected


... as a resultset, however there are no columns in the data pane, so it is useless except for debugging within Query Analyzer.

You can correct this behavior by adding the following to the top of your procedure:

SET NOCOUNT ON


This prevents the messages from factoring into your ASP code.

If your database code is not changeable, you might experiment with adding set rs = rs.nextRecordset() lines until you hit the first 'real' resultset.


擒兽 2006-02-01
  • 打赏
  • 举报
回复
除了楼上的

一般情况下数据库无该字段会出此错误
zy51 2006-02-01
  • 打赏
  • 举报
回复
一般情况字段名写错会报这样的错,仔细检查.

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧