ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • 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
HDeclareExternal (Example)
Example: Importing a file description from an existing data file
WINDEVWEBDEV - Server codeReports and QueriesWindowsUser code (UMC)Ajax
The following example allows you to use the "C:\AnExample\CUSTOMER.FIC" file in the current application. This data file is described in the "Example" application. It is imported into the current application as "CustomerWD". Its structure is automatically imported into the analysis of the current project. This allows you to add a record into this data file for example.
CustomerWD is Data Source
// Imports the description of CUSTOMER file as CustomerWD
HDeclareExternal("C:\AnExample\CUSTOMER.FIC", "CustomerWD")
 
// Add a record
CustomerWD.Name = "Montgomery"
...
HAdd(CustomerWD)
 
// Closes the file
HClose(CustomerWD)
 
// The description is not required anymore
HCancelDeclaration(CustomerWD)
Example: Importing an HFSQL Client/Server file with password
dsMyHotel is Data Source
New_connection is Connection
 
HPass(dsMyHotel, "Tahiti")
 
// Connection parameters
New_connection.Provider = hAccessHFClientServer
New_connection.User = "MyUser"
New_connection.Password = "MyPassword"
New_connection.Server = "MyServerIP"
New_connection.Database = "MyDatabase"
 
// Open the connection
IF NOT HOpenConnection(New_connection) THEN
Error("Connection error: ", HErrorInfo())
RETURN
END
IF NOT HDeclareExternal(".\Hotels.fic","dsMyHotel", New_connection) THEN
Error("Error on the external declaration: ", 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
 
// Connection parameters
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
 
// Open the connection
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))
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/17/2023

Send a report | Local help