|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
DSN, Storing variable permanently
Originally posted by : thunderain (lbrennan1@sympatico.ca)I have Windows 98. My two databases is set up in Control Panel, ODBC Data Sources, User DSNMy program will be using two databases. I am using a drop down menu for the user to pick which database to work with. Once the database is picked, they will be using it on all other pages. After selecting the database, I need to store the variable somewhere to access it on all other pages. I have used global.asa to store variables that are hardcoded in and that works find. Reading up on it, i don't see how to send a variable to global.asa to store it, or for that matter if you can.Can you send a varible to global.asa to be stored and used in other pages?If yes, how?Should I put it in an asp include, I am going in that direction? Here is my code.------selectdatabase.asp-------- Database: GateKeeper GKAdmin ----Choose One------ ! ----------database-var.asp----------1/ It seens to be selecting the database ok. There are no errers, but I am not getting anything from Response.write username2/ When the database is selected, how do i store it permanently while the user goes to other pages and call it from other pages?Thank you, Larry
|
|
#2
|
|||
|
|||
|
Originally posted by : thanks JoeIt works great, problem solved!!!------------Joe at 1/22/2002 11:14:40 AMIn response to your 2 primary questions at the bottom:1) You are not seeing any value in your response statement because your code thinks the word username is a variable (which has not been assigned a value)To get the username as returned from your select statement, use this syntax:Response.write objRS("username")Your objRS object contains the results of your query - you must address your object to get the username value. 2) To store the selected DSN for use on other pages, I suggest using a cookie. Insert this code for the cookie in your database-var.asp file:'** Create new cookieresponse.cookies("db").Path = "/"response.cookies("db")("dsn") = trim(request.form("database"))To call the database DSN value on your other pages, simply refer to your cookie value
SN = request.cookies("db")("dsn")Hope this helps------------thunderain at 1/20/2002 2:58:14 AMI have Windows 98. My two databases is set up in Control Panel, ODBC Data Sources, User DSNMy program will be using two databases. I am using a drop down menu for the user to pick which database to work with. Once the database is picked, they will be using it on all other pages. After selecting the database, I need to store the variable somewhere to access it on all other pages. I have used global.asa to store variables that are hardcoded in and that works find. Reading up on it, i don't see how to send a variable to global.asa to store it, or for that matter if you can.Can you send a varible to global.asa to be stored and used in other pages?If yes, how?Should I put it in an asp include, I am going in that direction? Here is my code.------selectdatabase.asp-------- ******** Database: GateKeeper GKAdmin ----Choose One------ ! ----------database-var.asp----------1/ It seens to be selecting the database ok. There are no errers, but I am not getting anything from Response.write username2/ When the database is selected, how do i store it permanently while the user goes to other pages and call it from other pages?Thank you, Larry |
|
#3
|
|||
|
|||
|
Originally posted by : Joe (joeridenour@yahoo.com)In response to your 2 primary questions at the bottom:1) You are not seeing any value in your response statement because your code thinks the word username is a variable (which has not been assigned a value)To get the username as returned from your select statement, use this syntax:Response.write objRS("username")Your objRS object contains the results of your query - you must address your object to get the username value. 2) To store the selected DSN for use on other pages, I suggest using a cookie. Insert this code for the cookie in your database-var.asp file:'** Create new cookieresponse.cookies("db").Path = "/"response.cookies("db")("dsn") = trim(request.form("database"))To call the database DSN value on your other pages, simply refer to your cookie value
SN = request.cookies("db")("dsn")Hope this helps------------thunderain at 1/20/2002 2:58:14 AMI have Windows 98. My two databases is set up in Control Panel, ODBC Data Sources, User DSNMy program will be using two databases. I am using a drop down menu for the user to pick which database to work with. Once the database is picked, they will be using it on all other pages. After selecting the database, I need to store the variable somewhere to access it on all other pages. I have used global.asa to store variables that are hardcoded in and that works find. Reading up on it, i don't see how to send a variable to global.asa to store it, or for that matter if you can.Can you send a varible to global.asa to be stored and used in other pages?If yes, how?Should I put it in an asp include, I am going in that direction? Here is my code.------selectdatabase.asp-------- ******** Database: GateKeeper GKAdmin ----Choose One------ ! ----------database-var.asp----------1/ It seens to be selecting the database ok. There are no errers, but I am not getting anything from Response.write username2/ When the database is selected, how do i store it permanently while the user goes to other pages and call it from other pages?Thank you, Larry |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > DSN, Storing variable permanently |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|