asp.net page connections

  • Thread starter Thread starter Tommi Kujala
  • Start date Start date
T

Tommi Kujala

How do you hadle connections in asp.net pages?
Do I have to dispose connection every time when
I leave from page and then establish one on a new page.

How about user controls, where connections are needed?
If I use user controls in page, there can be many connections
open in one page, right?

Thanks for answers. I am just thinking generally handling connection
on pages and dont want to mess up with this thing.
It´s quite important in performance issues.

-Tommy
 
Hi,

Generally, using database connections on ASP.NET pages is not great practice
as your pages will contain data access code. I recommend creating a number
Data Access Objects which look after talking to the database and returning
DataSets or DataReaders. This promotes reuse of the data access code, and
makes your projects easier to maintain.

Have a look at this sample application for example -
http://www.ntiergen.net/samples/contacts

Thanks,
Gavin Joyce
www.gavinjoyce.com

--
___________________________________________________________
nTierGen.NET Code Generator - http://www.nTierGen.NET/

Stored Procedures (Get, GetPaged, Insert, Update, Delete)
Data Access Layer - C#
Business Rules Layer - C# & VB.NET
Strongly-Typed DataSets - C#
Web Services - C#
___________________________________________________________
 
Back
Top