Subject: Multiple Database Connections
Posted By: rit01 Post Date: 9/19/2006 8:32:19 AM
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
Reply By: dparsons Reply Date: 9/19/2006 8:51:29 AM
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.
Reply By: rit01 Reply Date: 9/19/2006 10:20:27 AM
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
Reply By: peace95 Reply Date: 9/20/2006 12:50:07 AM
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.
Reply By: dparsons Reply Date: 9/20/2006 6:05:26 AM
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.
Reply By: rit01 Reply Date: 9/20/2006 7:28:08 AM
Thats correct. Thanks for the input anyway.
Reply By: peace95 Reply Date: 9/20/2006 12:42:57 PM
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.

Go to topic 49821

Return to index page 169
Return to index page 168
Return to index page 167
Return to index page 166
Return to index page 165
Return to index page 164
Return to index page 163
Return to index page 162
Return to index page 161
Return to index page 160