Instantiating a StringBuilder won't take that much time. There is ReadAhead option available on Windows 8, but I don't see any way to know if there is more data.
>Hi everybody,
>
>I know that NextResult() method of the SqlDataReader will get next result. However, is there a way to find out if SqlDataReader has multiple results or not?
>
>In particular, I have the following code
>
>
> StringBuilder result = new StringBuilder(returnMessage);
>
> while (sqlDataReader.NextResult())
> {
> result.AppendFormat("\r\n{0}", GetFormattedReturn(sqlDataReader, returnType, out recordCount));
> }
> returnMessage = result.ToString();
>
>However, there is no need to create a new instance of the StringBuilder if the reader has only a single result set. I did a very quick google search and didn't find a way to find out by some property if the reader has multiple results.
>
>Do you know if there is such a property or there is another way to handle the above efficiently?
>
>Thanks in advance.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer