ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Example 1: Initializing and browsing a query on HFSQL data files
  • Example 2: Initialization and browsing a query on an OLE DB file
HExecuteQuery (Example)
Example 1: Initializing and browsing a query on HFSQL data files
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)AjaxHFSQL ClassicHFSQL Client/ServerStored proceduresHyper File 5.5 The following example is used to initialize a query and to browse it.
// Initializes the query
IF HExecuteQuery(QRY_MyQuery) = False THEN
Error("Error while initializing the query" + CR + HErrorInfo())
RETURN
END
 
// Read the first record of the query
HReadFirst(QRY_MyQuery)
WHILE NOT HOut()
 // Process on the query record
 ...
 // read the next record
 HReadNext()
END
HCancelDeclaration(QRY_MyQuery)
Example 2: Initialization and browsing a query on an OLE DB file
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxOLE DB The following example is used to initialize a query and to browse it.
// MyQuery = "Select * from Customers where CustomerID =?"
// Customers is an OLEDB file that used the "MyConnection1" connection
 
// The query is run on "MyConnection1"
HExecuteQuery(MyQuery, hQueryDefault, 5)
 
// Change the connection used by the "Customers" file
HChangeConnection(Customers, "MyConnection2")
// The query is run on "MyConnection2"
HExecuteQuery(MyQuery, hQueryDefault, 5)
// Starts a transaction on "MyConnection3"
SQLTransaction(sqlStart, "MyConnection3")
// Runs the query on "MyConnection3"
// regardless of the connection used by the "Customers" file
HExecuteQuery(MyQuery, "MyConnection3", hQueryDefault, 5)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help