SqlDataReader.Read - is there a size limit? RRS feed

  • Question




    I have a stored procedure running in SQL Server 2005 which generates XML. This is achieved by using the FOR XML feature of SQL Server 2005.


    The resutant XML is going to be large - in the region of 5MB. My test data is currently returning 200Kb which is small in comparison, however I am still experiencing a problem.



    I have a project in Visual Studio 2005, written in VB.Net. I'm using DataAccess' ExecuteReader to run the stored procedure. I am then performing a SqlDataReader.Read() to access the data.


    This is only giving me around 2Kb of data - the first 2034 bytes to be precise, and the rest is somehow not being passed.




    Can anyone offer any insight into why this might be and possible workarounds?


    Many Thanks



    Wednesday, January 23, 2008 4:33 PM

All replies

  • Problem solved.


    It turns out that SqlDataReader.Read() was only fetching a certain number of characters. Not sure if this is an in-built limit, or if there is something in my data to cause this.


    Here's the code I had:



    Code Snippet

    Do While XMLData.Read()

    return XMLData.Item(0).ToString





    I've changed this so that I continue to read from the SqlDataReader until there's no more data, building a string along the way and then returning that.


    Code Snippet

    Do While jobsXMLData.Read()



    Return xmlData.ToString



    Thursday, January 24, 2008 9:54 AM
  • Just wanted to say thanks for supplying this information online.  I had the EXACT same problem and was getting very frustrated.

    I took the information you supplied, applied it to my problem, and now it works seemlessly!
    Thursday, July 24, 2008 5:53 PM