|
|
|
|
|
- Example: Importing a file description from an existing data file
- Example: Importing an HFSQL Client/Server file with password
- Example: Connecting to the file of Groupware users
- Example: Executing a SQL query on a data source declared by the HDeclareExternal function
HDeclareExternal (Example)
Example: Importing a file description from an existing data file Example: Importing an HFSQL Client/Server file with password sdMonHotel is Data Source
Nouvelle_connexion is Connection
HPass(sdMonHotel, "Tahiti")
Nouvelle_connexion.Provider = hAccessHFClientServer
Nouvelle_connexion.User = "MonUtilisateur"
Nouvelle_connexion.MotDePasse = "MonMotDePasse"
Nouvelle_connexion.Server = "MonIPServeur"
Nouvelle_connexion.Database = "MaBaseDeDonnees"
IF NOT HOpenConnection(Nouvelle_connexion) THEN
Error("Erreur de connexion : ", HErrorInfo())
RETURN
END
IF NOT HDeclareExternal(".\Hotels.fic","sdMonHotel", Nouvelle_connexion) THEN
Error("Erreur sur la déclaration externe : ", HErrorInfo())
RETURN
END
HReadFirst(sdMonHotel)
Info(sdMonHotel.Nom)
Example: Connecting to the file of Groupware users This example explains how to connect to the user file of User Groupware when this file is an HFSQL Client/Server file. sdGPWUTIL is Data Source
Nouvelle_connexion is Connection
Nouvelle_connexion.Provider = hAccessHFClientServer
Nouvelle_connexion.User = "mon utilisateur"
Nouvelle_connexion.MotDePasse = "mon mot de passe"
Nouvelle_connexion.Server = "mon serveur"
Nouvelle_connexion.Database = "ma base de données"
Nouvelle_connexion.Encryption = hEncryptionNO
IF NOT HOpenConnection(Nouvelle_connexion) THEN
Error(HErrorInfo())
RETURN
END
HPass(sdGPWUTIL,"PCSGPW2001")
IF NOT HDeclareExternal(".\Gpw_GPWU_HFCS\\GPWUTILISATEUR.fic", sdGPWUTIL, Nouvelle_connexion) THEN
Error(HErrorInfo())
RETURN
END
sdGPWUTIL.login = "testman"
IF NOT HAdd("sdGPWUtil") THEN Error(HErrorInfo())
Example: Executing a SQL query on a data source declared by the HDeclareExternal function This example shows how to execute a SQL query on a data source declared by the HDeclareExternal function. The "Name" property must be used.
cnxConnexionSuivi is Connection
cnxConnexionSuivi.User = "Nom_Utilisateur"
cnxConnexionSuivi.MotDePasse = ""
cnxConnexionSuivi.Server = "Nom_Server"
cnxConnexionSuivi.Database = "Nom_Base"
cnxConnexionSuivi.Provider = hAccessHFClientServer
cnxConnexionSuivi.Access = hOReadWrite
sArticle is Data Source
sdRetourReq is Data Source
sReq is string =
[
SELECT *
FROM %1
]
IF NOT HOpenConnection(cnxConnexionSuivi) THEN
Trace("Erreur de connexion à la BDD du suivi" + CR + HErrorInfo(hErrFullDetails))
EndProgram()
END
IF NOT HDeclareExternal(".\ARTICLE.FIC", sArticle, cnxConnexionSuivi) THEN
Trace("Le fichier sArticle n'a pas pu être déclaré" + CR + HErrorInfo(hErrFullDetails))
EndProgram()
END
sReq = StringBuild(sReq, sArticle..Name)
Trace(sReq)
IF HExecuteSQLQuery(sdRetourReq, cnxConnexionSuivi, hQueryDefault, sReq) THEN
FOR EACH sdRetourReq
Trace(sdRetourReq.DESA_ART)
END
ELSE
Trace(HErrorInfo(hErrFullDetails))
EndProgram()
END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|