DataSet Disposal

Discussion in 'ASP .Net' started by TCORDON, Mar 22, 2005.

  1. TCORDON

    TCORDON Guest

    Should I Dispose a DataSet immediately after binding a control to it's data?

    cbox.DataSource=DS
    etc...
    etc...
    cbox.DataBind()
    DS.Dispose

    TIA
    TCORDON, Mar 22, 2005
    #1
    1. Advertising

  2. TCORDON

    TCORDON Guest

    The reason I ask this is because I have a WebForm that loads and binds a
    couple of controls to diferent DataSets, but if I close the IE window
    sometimes i get an error Message:

    "The instruction at 0x00d95f6c referenced memory at 0x00d95f6c. The memory
    could not me read."

    Thanks


    "TCORDON" <> wrote in message
    news:...
    > Should I Dispose a DataSet immediately after binding a control to it's
    > data?
    >
    > cbox.DataSource=DS
    > etc...
    > etc...
    > cbox.DataBind()
    > DS.Dispose
    >
    > TIA
    >
    >
    TCORDON, Mar 22, 2005
    #2
    1. Advertising

  3. No, since the DataSet is disconnected from the datasource, there's really no
    reason to be concerned with this.
    The DataSet will be automatically disposed.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "TCORDON" <> wrote in message
    news:...
    > Should I Dispose a DataSet immediately after binding a control to it's
    > data?
    >
    > cbox.DataSource=DS
    > etc...
    > etc...
    > cbox.DataBind()
    > DS.Dispose
    >
    > TIA
    >
    >
    Steve C. Orr [MVP, MCSD], Mar 22, 2005
    #3
  4. TCORDON

    JiangZemin Guest

    No, theres no reason to do this. Note that with DataReaders, its a
    different story.
    But disposing DataSets isnt needed.

    HTH,
    Premier JiangZemin

    "TCORDON" <> wrote in message
    news:...
    > Should I Dispose a DataSet immediately after binding a control to it's
    > data?
    >
    > cbox.DataSource=DS
    > etc...
    > etc...
    > cbox.DataBind()
    > DS.Dispose
    >
    > TIA
    >
    >
    JiangZemin, Mar 23, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cameron

    DirectoryEntry Disposal Test

    cameron, Apr 13, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    504
    Willy Denoyette [MVP]
    Apr 14, 2004
  2. Roger Twomey
    Replies:
    3
    Views:
    751
    Chris R. Timmons
    Feb 18, 2005
  3. ASP.NET Object Disposal

    , Aug 20, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    409
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Aug 21, 2006
  4. patrick

    disposal of object

    patrick, Dec 20, 2007, in forum: Java
    Replies:
    3
    Views:
    325
    Thomas Kellerer
    Dec 20, 2007
  5. Amadrias

    Session object correct disposal

    Amadrias, May 3, 2006, in forum: ASP .Net Security
    Replies:
    0
    Views:
    98
    Amadrias
    May 3, 2006
Loading...

Share This Page