Forums: Unique Database per Login - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Unique Database per Login Once users login, connect them to their own unique database Rate Topic: -----

#1 User is offline   PDI 

  • Member
  • PipPip
  • Group: Members
  • Posts: 24
  • Joined: 10-June 14

Posted 08 March 2019 - 11:01 PM

I am looking at making a site where once the user has logged in, I want to re-direct them to a different database for the information. I have added a 'dbname' field to the users table which is stored in the 'master' database. Once they log in to this, I want to then find the users 'dbname' value and connect them to that database for all other activity. I would prefer if I can setup a connection string to use in the 'users' table, but if I have to use a web.config connection string name, that would be okay too.
0

#2 User is offline   timnorvel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 273
  • Joined: 21-September 07
  • Gender:Male
  • Location:Minnesota, USA

Posted 08 March 2019 - 11:17 PM

Have you seen this in the help file:

https://xlinesoft.co...tconnection.htm
0

#3 User is offline   PDI 

  • Member
  • PipPip
  • Group: Members
  • Posts: 24
  • Joined: 10-June 14

Posted 08 March 2019 - 11:19 PM

View Posttimnorvel, on 08 March 2019 - 03:17 PM, said:

Have you seen this in the help file:

https://xlinesoft.co...tconnection.htm


I have tried this, however after testing, I still see list results from the same database. I presume this only affects my own DB. calls and not the built in database connection.
0

#4 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16278
  • Joined: 03-February 03
  • Gender:Male

Posted 10 March 2019 - 02:28 AM

Check this:
https://asprunner.co...se-name-via-url

This is for PHPRunner but idea is the same - read database name from the session variable.
Best regards,
Sergey Kornilov
0

#5 User is offline   PDI 

  • Member
  • PipPip
  • Group: Members
  • Posts: 24
  • Joined: 10-June 14

Posted 11 March 2019 - 03:15 PM

View Postadmin, on 09 March 2019 - 06:28 PM, said:

Check this:
https://asprunner.co...se-name-via-url

This is for PHPRunner but idea is the same - read database name from the session variable.


I did see that, however I am not a PHP developer, so I am having a hard time figuring out where I put this code, and what 'sys_dbname' represents. Here is basically the code that I am trying to use in the 'After successful login' event:

strSQLExists = String.Format("select dbname from Companies where ID='{0}'",companyid);
rsExists = CommonFunctions.db_query(strSQLExists, null);
XVar rs2 = CommonFunctions.db_fetch_array(rsExists);
string dbname = rs2["dbname"];
XSession.Session["dbname"]=dbname;
DB.SetConnection(dbname);
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users