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. Other Discussions
  3. The Weird and The Wonderful
  4. Why DataSet always returns null?

Why DataSet always returns null?

Scheduled Pinned Locked Moved The Weird and The Wonderful
helpquestion
23 Posts 17 Posters 5 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.
  • C che3358

    His purpose was to clear object DataSet in section finally. But, do you guys think the DataSet will be cleared if no error is caught?

    private bool CheckData()
    {
    DataSet ds = null;
    try
    {
    //Get Data, and fill ds
    //if there is data in the ds's table
    return true;
    }
    catch{}
    finally
    {
    ds = null;
    }

    return false;
    

    }

    L Offline
    L Offline
    Lieutenant Frost
    wrote on last edited by
    #21

    Uhh...yes? That's the entire point of the Finally... statement. :doh:

    “Acer, Gateway, and eMachines are the same company now. Great! Now we just need a really big toilet, and we can get rid of all three at once.”

    1 Reply Last reply
    0
    • P PIEBALDconsult

      "A little knowledge is a dangerous thing." -- Alexander Pope

      C Offline
      C Offline
      Chris Quinn
      wrote on last edited by
      #22

      Just to be pedantic - Pope's quotation is actually "A little learning is a dangerous thing"

      ==================================== Transvestites - Roberts in Disguise! ====================================

      1 Reply Last reply
      0
      • D Dan Neely

        That said, I suggest you and your cow-orker might want to start by learning what the finally block does.

        Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

        B Offline
        B Offline
        BillW33
        wrote on last edited by
        #23

        This post is definitely in the correct forum. The poster knows what is wrong with the code. The person that is new to try/catch/finally doesn’t realize it yet ;)

        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