Re: Closing connections!

From: William \(Bill\) Vaughn (billvaRemoveThis_at_nwlink.com)
Date: 12/27/04


Date: Mon, 27 Dec 2004 13:55:39 -0800

ADO.NET gives you the option of choosing a connected or disconnected
approach. Yes, the Fill method does close connections automatically, but it
leaves the connection state unchanged if you open the connection first. When
working with ASP architectures, you need to make sure connections are closed
(and ADO.NET's Fill can do that for you), but when working with
client/server Windows Forms applications, it sometimes makes sense to leave
connections open while the application is open. ADO.NET does not
automatically close any connection you open manually--that must be done in
your code. Unlike ADO classic (and VB6) you can't depend on the garbage
collector to close connections for you.

hth

-- 
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Nab" <Nab@discussions.microsoft.com> wrote in message 
news:07AFE509-8C0E-4668-AD4A-F0E5C1AB5A7C@microsoft.com...
> Can someone please tell me why most text books talk about the importance 
> of
> closing connections after opening them when ADO .Net supports a 
> disconnected
> data access model?
>
> Why bother closing connections if ADO .Net does that automatically?
>
> I will be grateful for some insights on this matter as I am new in this 
> rea.
>
> Regards. 


Relevant Pages

  • Re: VS 2003.net
    ... retry some connections and then try the create function again. ... myRS is an ado recordset connecting to an ODBC database and a single table. ... IsDBNull does not return the correct value causing runtime errors. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: ADO - Bad when it is time to Optimize
    ... in COM-ATL and the data access is thru ADO to SQL. ... You cannot set the max pool size. ... There is no way to disable the pooling ... You cannot know whether non-pooled connections are happening ...
    (microsoft.public.data.ado)
  • Re: MS Access 97 vs. XP/2003
    ... > be a web-based app). ... All the connections to the SQL DB are via ADO. ... recordset, containing modified data, may or may not come back eventually. ...
    (microsoft.public.access.modulesdaovba)
  • app roles and ADO connections
    ... I'm having problems with the combination of SQL Server ... application roles and ADO connections. ... problematic since the approles is strictly a SQL Server ... In some cases ADO will create additional connections ...
    (microsoft.public.sqlserver.security)
  • ADO question
    ... I've been using ODBC for all of my DB connections, ... searching for something that is coherent regarding ADO. ... When I issue this command in an SQL command line, ...
    (microsoft.public.vc.mfc)