简体   繁体   English

SqlDatareader具有包含多个结果集的行

[英]SqlDatareader Has Rows with Multiple Result Sets

I have a result sets in which there are 3 results. 我有一个结果集,其中有3个结果。 The first result set has no rows and next result sets has rows. 第一个结果集没有行,而下一个结果集有行。 How to check if each result sets has rows? 如何检查每个结果集是否有行?

When i tried this it is saying false 当我尝试这是说错

reader.HasRows //this returns false

reader.NextResult() 

reader.HasRows //this agains returns false but this result has rows

Try to execute your query directly from SQL to see what is the result you get. 尝试直接从SQL执行查询以查看得到的结果。 Maybe you could try to re-think the original query and insert there a check for empty result set. 也许您可以尝试重新考虑原始查询,然后在其中插入空结果集的检查。

Here is a sample of DataReader with multiple result sets: do you see something different from the code you're using? 这是具有多个结果集的DataReader 的示例 :您看到与所使用的代码不同的东西吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM