|
|
|
|
|
- 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 dsMyHotel is Data Source
New_connection is Connection
HPass(dsMyHotel, "Tahiti")
New_connection.Provider = hAccessHFClientServer
New_connection.User = "MyUser"
New_connection.Password = "MyPassword"
New_connection.Server = "MyServerIP"
New_connection.Database = "MyDatabase"
IF NOT HOpenConnection(New_connection) THEN
Error("Connection error: ", HErrorInfo())
RETURN
END
IF NOT HDeclareExternal(".\Hotels.fic","dsMyHotel", New_connection) THEN
Error("External declaration error: ", HErrorInfo())
RETURN
END
HReadFirst(dsMyHotel)
Info(dsMyHotel.Name)
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. dsUSERGPW is Data Source
New_connection is Connection
New_connection.Provider = hAccessHFClientServer
New_connection.User = "my user"
New_connection.Password = "my password"
New_connection.Server = "my server"
New_connection.Database = "my database"
New_connection.Encryption = hEncryptionNO
IF NOT HOpenConnection(New_connection) THEN
Error(HErrorInfo())
RETURN
END
HPass(dsUSERGPW, "PCSGPW2001")
IF NOT HDeclareExternal(".\Gpw_GPWU_HFCS\\USERGPW.fic", dsUSERGPW, New_connexion) THEN
Error(HErrorInfo())
RETURN
END
dsUSERGPW.login = "testman"
IF NOT HAdd("dsUSERGPW") 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" (User_Name)
cnxConnexionSuivi.Password = ""
cnxConnexionSuivi.Server = "Server_Name"
cnxConnexionSuivi.Database = "Nom_Base"
cnxConnexionSuivi.Provider = hAccessHFClientServer
cnxConnexionSuivi.Access = hOReadWrite
sArticle is Data Source
sdRetourReq is Data Source
sReq is TO string =
[
SELECT *
FROM %1
]
IF NOT HOpenConnection(cnxConnexionSuivi) THEN
Trace("Follow-up DB connection error" + CR + HErrorInfo(hErrFullDetails))
EndProgram()
END
IF NOT HDeclareExternal(".\ARTICLE.FIC", sArticle, cnxConnexionSuivi) THEN
Trace("The file sArticle could not be declared" + CR + HErrorInfo(hErrFullDetails))
EndProgram()
END
sReq = StringBuild(sReq, sArticle..Name)
Trace(sReq)
IF HExecuteSQLQuery(sdRetourReq, cnxConnexionSuivi, hQueryDefault, sReq) THEN
FOR ALL sdRetourReq
Trace(sdRetourReq.DESA_ART)
END
ELSE
Trace(HErrorInfo(hErrFullDetails))
EndProgram()
END
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|