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

Posted on 2004-11-17
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?


Question by:6784
    LVL 7

    Accepted Solution

    You can set your connection string as a session variable based on which button/region the user selects

    Author Comment

    Could you show me an example,just to make it worth 300 points
    LVL 7

    Expert Comment


      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,

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now