PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Connection with an HFSQL analysis
  • Various
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Closes the current connection and frees the memory used by the connection. SQLDisconnect must be systematically called to close the connection, even if this connection failed.
PHP There is no need to use SQLDisconnect in the following cases
  • if no session is used.
  • if the connection failed.
Versions 16 and later
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code The SQL functions are used to handle the local databases (such as Web SQL databases). For more details, see Accessing a database in local mode (SQLite).
New in version 16
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code The SQL functions are used to handle the local databases (such as Web SQL databases). For more details, see Accessing a database in local mode (SQLite).
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code The SQL functions are used to handle the local databases (such as Web SQL databases). For more details, see Accessing a database in local mode (SQLite).
Example
WEBDEV - Server codeAjaxHFSQLHFSQL Client/ServerHyper File 5.5
// Exemple attaché à l'analyse GESCOM
// TABLE_TableReq est une table mémoire
ResConnect is int
ResExec is boolean
MaBase is string = "C:\GESCOM.WDD"
ResConnect = SQLConnect(MaBase, "", "")
IF ResConnect <> 0 THEN
ResExec = SQLExec("SELECT NOM, VILLE FROM POP", "REQ1")
IF ResExec = True THEN
// Récupérer les données dans la table
SQLTable("REQ1", TABLE_TableReq)
ELSE
// Erreur d'exécution de la requête
// Récupérer les informations relatives à la requête exécutée
SQLInfo("REQ1")
Error(SQL.MesError)
END
// Libérer la requête dans tous les cas
SQLClose("REQ1")
ELSE
 // Erreur de connexion
 Error("La connexion à la base" + MaBase + "a échoué")
END
// Libérer la requête dans tous les cas
SQLDisconnect()
Syntax
SQLDisconnect()
Remarks
WEBDEV - Server codeAjaxHFSQLHFSQL Client/ServerHyper File 5.5

Connection with an HFSQL analysis

In the case of a connection with an HFSQL evaluation, function SQLDisconnect closes the evaluation (equivalent to function HCloseAnalysis). To continue to use the analysis files, the analysis must be opened by HOpenAnalysis.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.

Various

  • A single connection can be established at a given time.
  • The memory allocated during the connection (execution of "SQLFreeConnect") is automatically freed.
Component: wd270hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Example with SQLConnect/SQLExec/SQLDisconnect
ConnectionNum is int
SourceName is string
// Connection to a specific data source via ODBC MS ACCESS
SourceName = "MS Access 97 Database"
ConnectionNum = SQLConnect(SourceName, "", "", "", "ODBC") // <--------
IF ConnectionNum <> 0 THEN
// The connection was successful

// Run the query and retrieve the result line by line
i is int = 0
SQLExec("SELECT LASTNAME, FIRSTNAME, EXTENSION, PHOTO FROM CUSTOMER", "QRY1") // <--------
WHILE SQLFetch("QRY1") = 0 // There is still another line to read
i++
// Retrieve the data
LASTNAME[i] = SQLGetCol("QRY1", 1)
FIRSTNAME[i] = SQLGetCol("QRY1", 2)
EXTENSION[i] = SQLGetCol("QRY1", 3)
{"IMAGE"+i} = SQLGetMemo("QRY1", 4)
END
SQLClose("QRY1")

ELSE
// The connection failed: display an error message
SQLInfo()
Error("The connection to the data source " + SourceName + " failed." + CR + ...
"Error code: " + SQL.Error + CR + SQL.MesError)

END
// In any case (connection OK or not)
SQLDisconnect() // <--------
BOLLER
11 Sep. 2018