Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic dsnless string set up

Status
Not open for further replies.

dazzleblu

Technical User
Aug 21, 2002
3
US
I am trying to set up a dynamic dsnless connection string, so I can use one set of pages connecting to different dabases (they all are the same, tables and fields, but different names.) A user chooses a database name, username and password. it is stored as a cookie, then it is retrieved to be used for the dsnless sting. The only way I know how, is below:

Sub Session_OnStart
Session("dbconn_ConnTimeout") = 30
Session("dbconn_CommandTimeout") = 60
Session("dbconn_CursorLocation") = 2
Session("dbconn_Host") = Request.Cookies("database")
Session("dbconn_UserName") = Request.Cookies("username" )
Session("dbconn_Password") = Request.Cookies("password" )

Session("dbconn_DsnlessString") = "DRIVER={MySQL};SERVER=66.xxx.xxx.xxx;DATABASE="&Session("dbconn_Host")&";UID="&Session("dbconn_UserName")&";PASSWORD="&Session("dbconn_Password")&""

End Sub

I can pull the variables from the cooke, but when I do a Response.Write Session("dbconn_DsnlessString"), nothing shows up.

Any Ideas?....
 
Try putting this part

strMySQL = "DRIVER={MySQL};SERVER=66.xxx.xxx.xxx;DATABASE="&Session("dbconn_Host")&";UID="&Session("dbconn_UserName")&";PASSWORD="&Session("dbconn_Password")&""

'# in a string first then put it in the session

Session("dbconn_DsnlessString") = strMySQL www.vzio.com
ASP WEB DEVELOPMENT



 
Yes, it worked very well, thank you! I tried it in the global.asa file, and for some reason my chilisoft server is not reading my .asa files. So, I created a session veriable in the page, and replaced the string just like above, and it worked!! Then I used an include file, and used the session variable like above, and it worked also!

Thank You.
 
Yes, it worked very well, thank you! I tried it in the global.asa file, and for some reason my chilisoft server is not reading my .asa files. So, I created a session veriable in the page, and replaced the string just like above, and it worked!! Then I used an include file, and used the session variable like above, and it worked also!

Thank You.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top