SqlDataReader的"枚举没有结果" [英] SqlDataReader "Enumeration yielded no results"

查看:1324
本文介绍了SqlDataReader的"枚举没有结果"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一直想弄清楚,但我做不到。

Been trying to figure out, but I can't.

我的SqlCommand通过并且已经退回不给我结果SqlDataReader对象执行存储过程,但是,我可以看到他们,如果一个探索调试器的对象。这里就是我谈论的图像:

I execute a Stored Procedure via SqlCommand and the SqlDatareader object that is returned doesn't give me the results, however, I can see them if a explore the object in the debugger. here's an image of what I'm talking about:

在它说,结果视图行枚举没有产生任何结果,但在路径:

In the Result View row it says "Enumeration yielded no results" but in the path:

基地 - >基础 - > ResultView - > [0] - >非公共成员 - > _values​​ - > [0],的 1 ,[2],[3]
结果示

base -> base -> ResultView -> [0] -> Non-Public members -> _values -> [0],1,[2],[3] the results are shown.

任何人有一个想法,如何让他们?

Anyone has an idea how to get them?

这是code我使用来获取和特定的列:

This is the code I'm using to get and specific column:

if (dataReader.Read())
{
   ProjectFolderId = dataReader["ItemID"].ToString();
}

如果是返回false。

在先进的感谢。

推荐答案

您需要小心:读者只能消耗的一次。由于被迫在preVIEW窗口可见的数据,这是完全有可能你已经消耗不小心在调试器中的数据,它是不再可用。

You need to be careful: a reader can only be consumed once. By having the data visible in the preview window, it is entirely likely you've consumed that data accidentally in the debugger, and it is no longer available.

请确保它的不可以可见/在调试器preVIEW窗口扩大,并重试。

Make sure it is not visible/expanded in a debugger preview window, and try again.

_values​​ 显示仅仅是传统的/仍然是成功读取的最后一行。

The _values shown is just the legacy/remains of the last row that was successfully read.

这篇关于SqlDataReader的"枚举没有结果"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆