Home All Groups Group Topic Archive Search About
Author
22 Mar 2005 10:25 PM
TCORDON
Should I Dispose a DataSet immediately after binding a control to it's data?

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

TIA

Author
22 Mar 2005 10:35 PM
TCORDON
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


Show quoteHide quote
"TCORDON" <tcord***@hotmail.com> wrote in message
news:OQqsF7yLFHA.3320@TK2MSFTNGP15.phx.gbl...
> Should I Dispose a DataSet immediately after binding a control to it's
> data?
>
> cbox.DataSource=DS
> etc...
> etc...
> cbox.DataBind()
> DS.Dispose
>
> TIA
>
>
Are all your drivers up to date? click for free checkup

Author
22 Mar 2005 10:49 PM
Steve C. Orr [MVP, MCSD]
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


Show quoteHide quote
"TCORDON" <tcord***@hotmail.com> wrote in message
news:OQqsF7yLFHA.3320@TK2MSFTNGP15.phx.gbl...
> Should I Dispose a DataSet immediately after binding a control to it's
> data?
>
> cbox.DataSource=DS
> etc...
> etc...
> cbox.DataBind()
> DS.Dispose
>
> TIA
>
>
Author
23 Mar 2005 4:22 AM
JiangZemin
No, theres no reason to do this.   Note that with DataReaders, its a
different story.
But disposing DataSets isnt needed.

HTH,
Premier JiangZemin

Show quoteHide quote
"TCORDON" <tcord***@hotmail.com> wrote in message
news:OQqsF7yLFHA.3320@TK2MSFTNGP15.phx.gbl...
> Should I Dispose a DataSet immediately after binding a control to it's
> data?
>
> cbox.DataSource=DS
> etc...
> etc...
> cbox.DataBind()
> DS.Dispose
>
> TIA
>
>

Bookmark and Share