 |
| ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 19th, 2006, 08:32 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
|
|
Multiple Database Connections
Hi
I am just developing an application and on the one interface there is the potential for a user to connect to its SQL Server Db 6 times depending on the parts of the interface they use.
To give you an example.. when they first access the page they will have a dropdown menu which is populated with DB content within the Page.Load event which is databound to another dropdown which triggers another DB connection, and the same again. Then it would populate a Gridview.
Is this bad design and can it be avoided?
Many thanks
Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER
|
|

September 19th, 2006, 08:51 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
I try to keep my roundtrips from my webserver ot my SQL server to a minimum but it all depends on the needs of the application. In your example of the dropdown list, it makes sense to make a second call to the database if the values of your second dropdownlist are dependant on what the value of the first dropdown is.
--Stole this from a moderator
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
|
|

September 19th, 2006, 10:20 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
|
|
Thanks dparsons. I have been sat here in isolation worrying whether it was connection overkill. But can't see any other way to trim it up.
Many thanks
Rit
|
|

September 20th, 2006, 12:50 AM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
|
|
Rit01: Would it not be appropriate to add or define all 6 connection strings to your web.config file? Then in your script use the "Select Case" to the different database connections. For a good example of using the web.config..SEE dparsons response to my topic Web.Config...Working or Not Working...
Just a thought....hope this helps.
|
|

September 20th, 2006, 06:05 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
What Rit is saying is that he makes 6 connections to his database, not 6 connections to 6 different database servers.
--Stole this from a moderator
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
|
|

September 20th, 2006, 07:28 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
|
|
Thats correct. Thanks for the input anyway.
|
|

September 20th, 2006, 12:42 PM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
|
|
Hmmmmmm.....it was the Topic Title that threw me, along with the narrative... Maybe if the Topic read: Multiple Connections to Single Database...
Like I said, it was just a thought.. I stand corrected.
|
|
 |