Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Do we need to close connection when we use strongly typed table adapters?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Max2006 - 11 Jul 2007 19:19 GMT
Hi,

I saw the Business Logic Layer pattern suggested at the following link and I
found that the pattern never closes the connection:

http://www.asp.net/learn/dataaccess/tutorial02cs.aspx?tabid=63

I am using strongly typed datasets and TableadApters. I assume that
TableadApters always closes the connections automatically. Is that correct
assumption?

Any help would be appreciated,,
Max
Peter Bradley - 11 Jul 2007 19:56 GMT
Ysgrifennodd Max2006:
> Hi,
>
[quoted text clipped - 9 lines]
> Any help would be appreciated,,
> Max

As far as I know you never need to close a connection if you use any
kind of DataAdapter (with a DataSet, of course).  I am not aware that it
does any harm, though.

HTH

Peter
Steven Cheng[MSFT] - 12 Jul 2007 03:48 GMT
Hi Max,

I agree with peter that you do not need to explicitly control the open and
close for the SQL connections when using DataAdapter. The dataAdapter's
internal code logic will help you control the connection's open and close.  
It is only when you use SqlCommand to return DataReader resultset will you
need to take care of the connection and reader's open and close.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
   

This posting is provided "AS IS" with no warranties, and confers no rights.
Steven Cheng[MSFT] - 16 Jul 2007 14:29 GMT
Hi Max,

How are you doing? Have you got any further idea on this? If there is
anything else need help, please don't hesitate to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
   

This posting is provided "AS IS" with no warranties, and confers no rights.
Max2006 - 17 Jul 2007 16:33 GMT
Hi Steven,

Thanks for followup. I am not explicitly closing the connection when I use
TableAdapter and monitored the connections to database through SQL Profiler.
Everything is working perfect! Thank you

> Hi Max,
>
[quoted text clipped - 9 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.