[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Webapp needs to beable to use 1 of 4 database, depending a users choice

Posted on 2004-11-17
3
Medium Priority
?
160 Views
Last Modified: 2010-04-23
I am building an  webapp for data entry. This will be on the companies intranet all over the world, which is divided in to four regions. A user will beable to pick one regions(database) complete their tasks and switch to a different region (database) and work in that environment. I am not sure how to do this. I am thinking I need 4 different .ini files for the different connection strings.  Ihave the user interface as four bottons, the user clicks their region and goes on from there. Any iedas?

thanks

6784
0
Comment
Question by:6784
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
LandyJ earned 1200 total points
ID: 12610027
You can set your connection string as a session variable based on which button/region the user selects
0
 

Author Comment

by:6784
ID: 12610053
Could you show me an example,just to make it worth 300 points
thanks
0
 
LVL 7

Expert Comment

by:LandyJ
ID: 12610339

  Private RegionalConnectStr As String = ""

  Private Sub btnRegion1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegion1.Click
    Session("MyConnectStr") = "<connect string1>"
  End Sub

  Private Sub btnRegion2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegion2.Click
    Session("MyConnectStr") = "<connect string2>"
  End Sub

  Private Sub btnRegion3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegion3.Click
    Session("MyConnectStr") = "<connect string3>"
  End Sub

  Private Sub btnRegion4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegion4.Click
    Session("MyConnectStr") = "<connect string4>"
  End Sub


Then, on all subsequent pages:

  Dim db As ADODB.Connection
  db.ConnectionString = Session("MyConnectStr")


Hope that helps,
Landy
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month19 days, 20 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question