473,466 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dataset dispose

Does dataset dispose will lead the related dataadpator , or database will
dispose also ?
Or I need to dispose them one by one ??

Apr 20 '07 #1
10 3992
On Apr 20, 4:56 am, "Agnes" <a...@dynamictech.com.hkwrote:
Does dataset dispose will lead the related dataadpator , or database will
dispose also ?
Or I need to dispose them one by one ??
You do not need to call Dispose on a DataSet. It's one of the few
exceptions to the rule that you should call Dispose when you're
finished using an object. It is recommended that you continue calling
Dispose on connection and data adapter objects though.

And no, calling Dispose on a DataSet will not dispose anything else.

Apr 20 '07 #2
you don't need to call .Dispose on anythnig

if the objects don't clean up after themselves then call up M$ tech
support

THIS CRAP IS NEITHER VISUAL NOR BASIC

On Apr 20, 7:56 am, Brian Gideon <briangid...@yahoo.comwrote:
On Apr 20, 4:56 am, "Agnes" <a...@dynamictech.com.hkwrote:
Does dataset dispose will lead the related dataadpator , or database will
dispose also ?
Or I need to dispose them one by one ??

You do not need to call Dispose on a DataSet. It's one of the few
exceptions to the rule that you should call Dispose when you're
finished using an object. It is recommended that you continue calling
Dispose on connection and data adapter objects though.

And no, calling Dispose on a DataSet will not dispose anything else.

Apr 20 '07 #3
On Apr 20, 9:58 am, Larry Linson <larrylinso...@hotmail.comwrote:
you don't need to call .Dispose on anythnig

if the objects don't clean up after themselves then call up M$ tech
support

THIS CRAP IS NEITHER VISUAL NOR BASIC
You don't *have* to call Dispose (or Close). In the case of an
IDbConnnection the GC will eventually clean it up, but until it does
you'll have a dangling connection that remains open.

Apr 20 '07 #4
"Larry Linson" <la***********@hotmail.comschrieb:
you don't need to call .Dispose on anythnig
That's true ("need" interpreted in the sense of "it's not necessary, but it
may cause the application to refuse to work properly"), but this doesn't
mean that it doesn't make sense to prevent the application from running out
of unmanaged resources (connections, file handles, ...).

I suggest to call 'Dispose' on every object that provides the method,
because alternative implementations of the .NET Framework may place code
there to free unmanaged resources.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Apr 20 '07 #5
I suggest to call 'Dispose' on every object that provides the method,

But don't do it myself.
You can look at my website you don't see any Textbox.dispose, label.dispose,
etc.
>
Written for M S Herfried K. Wagner. I hope he likes it I did some work
for him.

Cor
Apr 23 '07 #6
On Apr 23, 1:39 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
I suggest to call 'Dispose' on every object that provides the method,

But don't do it myself.
You can look at my website you don't see any Textbox.dispose, label.dispose,
etc.
Those are eventually called through the Control.Dispose implementation
of the containing Form.

Apr 23 '07 #7
"Brian Gideon" <br*********@yahoo.comschrieb:
I suggest to call 'Dispose' on every object that provides the method,

But don't do it myself.
You can look at my website you don't see any Textbox.dispose,
label.dispose,
etc.

Those are eventually called through the Control.Dispose implementation
of the containing Form.
Right.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Apr 23 '07 #8
Brian,

You would not believe it, I know that already some time.
But therefore Herfrieds advise is even more wrong if you know that..

Cor

"Brian Gideon" <br*********@yahoo.comschreef in bericht
news:11**********************@y5g2000hsa.googlegro ups.com...
On Apr 23, 1:39 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
I suggest to call 'Dispose' on every object that provides the method,

But don't do it myself.
You can look at my website you don't see any Textbox.dispose,
label.dispose,
etc.

Those are eventually called through the Control.Dispose implementation
of the containing Form.

Apr 24 '07 #9
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
You would not believe it, I know that already some time.
But therefore Herfrieds advise is even more wrong if you know that..
Well, I should have written: "I suggest to make sure 'Dispose' is called on
every object implementing 'IDisposable' when the object is not needed any
more."

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Apr 24 '07 #10
For sure that is a fine text in my idea completely as it has to be.

But also for by instance members from the namespace System.Data.

Where the team has taken the action to dispose if it is needed after every
close.

Cor

"Herfried K. Wagner [MVP]" <hi***************@gmx.atschreef in bericht
news:eX**************@TK2MSFTNGP04.phx.gbl...
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
>You would not believe it, I know that already some time.
But therefore Herfrieds advise is even more wrong if you know that..

Well, I should have written: "I suggest to make sure 'Dispose' is called
on every object implementing 'IDisposable' when the object is not needed
any more."

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Apr 24 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Grant | last post by:
Hello, How come when I add a new row to my dataset table it shows up as changed (agencyData.Haschanges() = True) but when I delete a row the dataset thinks here are no...
2
by: Hans Kesting | last post by:
Hi, What are the performance benefits of calling Dispose on a DataSet? We have a (web) application that we tried to run on a shared server. It crashed due to memory constraints. The helpdesk...
35
by: MuZZy | last post by:
Hi All, I got a issue here and hope someone can help me: Let's consider this code: // =================== CODE START ================================= using System; using System.Data; ...
0
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
0
by: crjunk | last post by:
Hi, I'm pulling data from 3 different databases into 1 DataSet. Is there a way that I can insert a new field into the DataSet and add a value (such as "MSBA", "AFCA", "AFNAT", etc...) to each...
2
by: Wayne Wengert | last post by:
I have a VB App (VSNET 2003) in which, during form load, I create a dataset (ds1) and then populate a datagrid by binding to the dataset. That works fine. The form has a button which, when clicked,...
0
by: Johnny | last post by:
I have a PocketPC mobile application that gets its data from the Sql Server database via a web service. The web service returns a dataset that I need to load into the SqlCe database on the mobile...
0
by: SL Culby | last post by:
Hello everyone, I have a project where I pull SQL Server data put it into a dataset and now I have to put the dataset data into an Access Database. The dataset currently is over 2000 row, so looping...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.