Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-30-2010, 04:51 AM   PM User | #1
mrfreeze81
New to the CF scene

 
Join Date: May 2008
Location: US
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
mrfreeze81 is an unknown quantity at this point
Multiple open close database connections in one page

I'm trying to create a website using ASP.NET 2.0, where one page during the process of Page_Load has to do multiple table reads from a single database schema. I have a Data Access Layer, which for each select statement returns a DataTable. This however has to open and close the database connection for each retrieval. (I use an ODBC connection to connect to my MySQL database).

I'm currently looking at 4-5 table select statements with open and close connections per page load. I am worried about the overload when the user pool accessing this page grows.

Is this effective programming or would I have to go for stored procs where there could be one open and close.

Thanks in advance,
__________________
---
Freeze
mrfreeze81 is offline   Reply With Quote
Old 09-30-2010, 06:25 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,200
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Modify the data access layer so it doesn't close the connection each time??
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 09-30-2010, 01:59 PM   PM User | #3
mrfreeze81
New to the CF scene

 
Join Date: May 2008
Location: US
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
mrfreeze81 is an unknown quantity at this point
Thank you. I don't want to change the DAL unless its really necessary. I have tried to write a SP to club a few of the insert/select statements which help me in eliminating some of the open and close statements from my code.

I'll probably have to come up with a better way eventually, as I will have to start integrating transactions and much more to that page.
__________________
---
Freeze
mrfreeze81 is offline   Reply With Quote
Reply

Bookmarks

Tags
.net, aps.net, database connection

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:36 AM.


Advertisement
Log in to turn off these ads.