Generating CSV reports that have 1 million+ rows in ASP.NET
<p>I am seeking your advice with regards to generating CSV reports. </p>

<p>I have an ASP.NET application that is produces reports on billing data. Recently, I have noticed that when it tries to export a report file the web application is unresponsive and will throw in an OutOfMemory exception or Server timeout exception.</p>

<p>What I did to amend this was to:</p>

<ul>
<li>Place the necessary indexes in SQL server to get the records faster</li>
<li>Use SqlDataReader to fetch the data from SQL server</li>
<li>Specify the criteria needed to pull out necessary records instead of getting all information in one call.</li>
</ul>

<p>I have also thought of limiting the maximum number of records returned from the database but the system needs to produce all information regardless of how big the rowcount is returned because the information being downloaded will be critical for our client's financial records.</p>

<p>I am wondering, what methods/solutions that can be used to render CSV reports that have huge data in ASP.NET? </p>

<p>Looking forward for your response.</p>

<p>Cheers,
Ann</p>
