Valerio Santinelli
Valerio Santinelli

Reputation: 1702

Flushing a Gembox Spreadsheet object to a stream while reading from a DataReader

Here's the scenario:

I tried using a DataTable with ReportViewer but the w3wp process memory usage skyrockets due to the entire DataTable being read into memory.

I thought that Gembox Spreadsheet would handle that scenario a little better, guessing that I could use a DataReader instead of the DataTable and just write a new row to the Excel workbook sheet and flush it over the HTTP stream. But I can't find that function anywhere in Gembox Spreadsheet. Has anyone achieved anything similar, either with Gembox or any other 3rd party component?

Upvotes: 0

Views: 1034

Answers (1)

TheTechGuy
TheTechGuy

Reputation: 17374

I am only guessing it here but you should be able to do it using SQLDataReader. SQL DataReader is different than SQL DataSet. The former retrieves one record at a time and it required live connection to DB. It should not create memory problem, I think. The later retrieves the whole table at once which can sky rocket the memory usage. Here is a good article from Microsoft, difference between datareader and dataset

Also note that Excel has limitation as well. Excel 2007 is pretty good by the way, can handle 1000k x 16k records. Older versions of Excel are definitely more limited. Excel 2007 Limitation

I am also thinking if Excel can handle such a large file , your program should handle 400k records. I know that is a lot of data but Operating System usually takes care of memory management unless you are doing something that is just plain wrong.

Upvotes: 0

Related Questions