Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Export GridView to Excel cause System.OutOfMemoryException

Export GridView to Excel cause System.OutOfMemoryException

Scheduled Pinned Locked Moved C#
helptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    ptvce
    wrote on last edited by
    #1

    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 ?

    OriginalGriffO 1 Reply Last reply
    0
    • P ptvce

      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 ?

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      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.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      P 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        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.

        P Offline
        P Offline
        ptvce
        wrote on last edited by
        #3

        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

        OriginalGriffO 1 Reply Last reply
        0
        • P ptvce

          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

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          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.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups