one application, 6 customers, 6 databases; avoid collisions between customers RRS feed

  • Question

  • At the moment, I have 6 different accounts for 6 customers.

    The code they use is exactly the same so a change requires a propagation to the 6 accounts.

    I use SQLDataSource as well as DetailsView and GridView.

    I tried to create one account, one set of code creating a Session variable with the connection data on each page.

    mixed results.

    Am I right that I cannot change the web app definition of the connection by testing which domain I'm on at the top of each page?  This is because once its changed, its application wide so there would be collisions between the changing party and one of the other 6 customers if they are working at the same time.

    Is there another way to do this that I'm not thinking about?

    I don't want the data for the 6 customers in one database.  I want the data isolated with the 6 databases.

    thx for your help


    Saturday, April 11, 2015 1:10 PM


  • Hi Rungusto,

    What do you mean testing domain I'm on at the top of each page? Generally an application, if not clustered, should host in a certain domain\server, regardless which domain a user is requesting from. And yes the change in a page is application wide.

    In my humble opinion, if you would like the 6 customers to use 6 isolated databases, you may reference the below.

    1. Create one table which contains user login credential and individual database connection strings. This table can be either in the one of the 6 databases or another individual one.
    2. When user logins, the default connection will access to the credential table to validate, if valid, get the connection string for the specific user. Then any interaction between the user and application will saved in the database connected with the specific connection string.

    Actually your requirement is not a typical question on SQL Server but on application development. Since this is a dedicated forum for SQL Server database, I would suggest you post your question in a application design or a correlated language in which your application is developed forum. It is more appropriate and more experts will assist you.

    If you have any question, feel free to let me know.

    Eric Zhang
    TechNet Community Support

    • Edited by Eric__Zhang Tuesday, April 14, 2015 2:24 AM
    • Proposed as answer by Eric__Zhang Monday, April 20, 2015 3:06 AM
    • Marked as answer by Eric__Zhang Tuesday, April 21, 2015 1:28 AM
    Tuesday, April 14, 2015 2:22 AM