FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
[WD20] Switching a connection var from client/server to classis files and back to client/server
[WD20] Switching a connection var from client/server to classis files and back to client/server
Débuté par Curtis, 21 juin 2017 22:42 - 2 réponses
Connectez-vous…
Curtis
#1
Posté le 21 juin 2017 - 22:42
I have a connection var that is defined in the project in it code. I use this connection var to successfully connect to my remote db. I can close the connection, modify the connection var to use local files and successfully connect to my local db. The problem is when I try to switch back to remote it's creating a new db somewhere. I can't find where the data is stored, but it's definitely stored somewhere. I get no errors when running the code. I can not understand why I can't reconnect to the remote db.
Here's my connection code. See anything suspect?:
ConnectRemoteDatabase() // Parameters of the database connection for 'Main' files in the analysis UserServer..Server = "myDbServer.com" UserServer..User = gsUserName UserServer..Password = gsPassword UserServer..Database = gsDatabase UserServer..Provider = hAccessHFClientServer UserServer..CryptMethod = hCryptNo UserServer..Compression = True UserServer..ExtendedInfo = "WD Connection Timeout = 8;" // Establish the connection IF NOT HOpenConnection(UserServer) THEN Error("Error opening user database.") RESULT False ELSE // Open and connect all files in the main folder Analysis IF NOT HChangeConnection("Main", UserServer) THEN Error("Error connecting to user database.") RESULT False END END RESULT True
DisconnectionCode() // This runs before ConnectRemoteDatabase() and ConnectLocalDatabase(). I have tried using either line or both. IF NOT HClose("*") THEN Trace("Error closing files") IF NOT HCloseConnection(UserServer) THEN Trace("Error closing connection")
ConnectLocalDatabase() UserServer..Server = "local data" UserServer..Provider = hAccessHF7 UserServer..Compression = True IF NOT HOpenConnection(UserServer) THEN Error(HErrorInfo()) ELSE // Open and connect Config file HChangeConnection("Main", UserServer) END
Signaler
0
0
Fabrice Harari
#2
Posté le 22 juin 2017 - 14:08
Hi Curtis,
you are doing a changeconnection to classic, but you are NOT doing a hchangedirectory to DEFINE where your files should be.
Just add a hchangedirectory to set the files where you want them and you'll be ok..
if you want to know WHERE they are without it, just do info(OneFoleName..Directory)
Best regards
Signaler
0
0
Curtis
#3
Posté le 22 juin 2017 - 16:35
HChangeDir(Main,"")
Thanks Fabrice!
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte