Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Location
    NYC Area
    Posts
    24

    Unanswered: Using variable for database in ODBC Connection string

    Is it possible to use a variable as the DATABASE= setting in a pass-thru query? I ask because I would like to use a single front-end (already developed) that can switch between different versions by changing the database via user selection. Example. If I have a pass-thru query that looks like this...
    ODBC;DSN=CAS Dev;DATABASE=CASSQL;Network=DBMSSOCN;...
    I would like the ability to change the DATABASE setting to be a global variable like tSelectedDatabase, which will be one of three available db's. Is this possible?
    Thanks in advance for any assistance...
    Chris

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    You could store the connection string in the global. When the database opens up it could 'figure' out what database to use and set the global variable. If I were doing it, I would store that setting in something other than a global. Whenever you have an untrapped error, globals will go away. You could have the connection string in a table and call a function that returned it. Then use the function whenever you need to get the connection string.

  3. #3
    Join Date
    Jun 2004
    Location
    NYC Area
    Posts
    24
    Thanks for the info...
    What I did was store the info in a table and then loop'd through all the querys to see if they're pass-thru or not. if so then I change the connect property to the appropriate code.
    Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •