Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing the DataSource of a Remote Connection?
Message
De
19/11/1999 13:05:32
Gregg Geeslin
Kwajalein Range Services
Apo, Californie, États-Unis
 
 
À
18/11/1999 16:26:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00292718
Message ID:
00293154
Vues:
23
>Is there a way to programmatically change the DataSource of a Remote connection? I have a bunch of views set up that access a Connection to an Oracle database. I don't want to have to duplicate the views just to change the connection name from the one pointing at the production DSN to the one pointing at the test DSN. The application I'm working with has both a production and a test environment for regular Fox tables, but this is the first time we've added remote data (which also has a production and a test environment) into the mix.
>
>TIA!
>
>Laurisa Watkins

Couldn't you do something like this

OPEN DATABASE MyDatabase EXCLUSIVE
DELETE CONNECTION MyConnection

IF Production

CREATE CONNECTION MyConnection ;
CONNSTRING "DSN=Production;UID=my_schema;PWD=my_password;SERVER=servername;"

ELSE
CREATE CONNECTION MyConnection ;
CONNSTRING "DSN=Test;UID=my_schema;PWD=my_password;SERVER=servername;"

ENDIF

And now open the views?

I can get by with this since I don't use the database that contains my views to do anything else other than contain those views. That way, opening it exclusively isn't such a headache as it might be otherwise.

I might recommend, too that you get the latest copy of gendbcx from Steve Arnott at http://www.stevearnott.com/ if you don't have it already. It's nice to convert a dbc into code before checking it into SourceSafe. It's also a nice way to learn the code behind the creation of the objects in the dbc. It's also nice to be able to hack on the code :)

I hope this helps.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform