Wrox Programmer Forums
|
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
 
Old September 19th, 2006, 08:32 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default 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
 
Old September 19th, 2006, 08:51 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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.
 
Old September 19th, 2006, 10:20 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

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
 
Old September 20th, 2006, 12:50 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
Default

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.
 
Old September 20th, 2006, 06:05 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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.
 
Old September 20th, 2006, 07:28 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default

Thats correct. Thanks for the input anyway.
 
Old September 20th, 2006, 12:42 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Database - connections gkn Oracle 1 December 20th, 2005 08:25 AM
Database - connections gkn Oracle 0 December 20th, 2005 07:27 AM
MS Access database connections proud900 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 June 22nd, 2005 08:21 PM
Multiple Connections to dBase derekinit Classic ASP Databases 0 June 3rd, 2005 09:35 PM
multiple database connections markhardiman Classic ASP Databases 7 September 9th, 2004 05:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.