Export GridView to Excel cause System.OutOfMemoryException
-
I want to export GridView (25000 records) to Excel. But i got an error message like : System.OutOfMemoryException was Thrown. But i need to export the records (even more than 25000 records) to excel How to solve this ?
Why the heck would you put 25,000 records (or more!) into a GridView? Do you expect your users to look at them? And perhaps work out which one of them they are actually interested in? Would you want to sit there and do that? And if your users aren't going to look at all those, then why are you wasting time, memory and space loading this into a GridView? Instead, look at where you are getting this data from, and transfer that directly into Excel - that way, it may well be quicker, more efficient and a lot less likely to run out of memory...
The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
-
Why the heck would you put 25,000 records (or more!) into a GridView? Do you expect your users to look at them? And perhaps work out which one of them they are actually interested in? Would you want to sit there and do that? And if your users aren't going to look at all those, then why are you wasting time, memory and space loading this into a GridView? Instead, look at where you are getting this data from, and transfer that directly into Excel - that way, it may well be quicker, more efficient and a lot less likely to run out of memory...
The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
-
its better that i transfer that directly into Excel but i dont know how can i do this, just i know bind a gridview and then convert it to excel
Google can help: https://www.google.co.uk/search?q=transfer+info+to+excel+c%23&oq=transfer+info+to+excel+c%23&aqs=chrome..69i57.7869j0j7&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8[^] The top link is a bit dated, but it'll work: http://support.microsoft.com/kb/306023[^] You can probably find a lot more recent documents than that with a little google-fu! :laugh:
The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.