ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / SQL functions
  • Example 1: Running a query without naming it
  • Example 2: Running a query and assigning its result to the controls of a query
  • Example 3: Running a query and retrieving information about this query
Example 1: Running a query without naming it
This example is used to run a deletion query without naming it. This query will return no result.
ResExec = SQLExec("DELETE CUSTOMER WHERE CUSTNUM = " + CustomerNum, "QRY1")
IF ResExec = False THEN
// Processes the error
END
Example 2: Running a query and assigning its result to the controls of a query
WINDEVWEBDEV - Server codeWindowsLinuxJavaUser code (UMC)PHPAjaxHyper File 5.5OLE DBODBC This example executes a query and populates the controls in the Form window with the result of the query.
// Run the query and assign the controls
ResExec = SQLExec("SELECT CUSTNAME, ADDR1, ADDR2, CITY, ZC FROM INV", "QRY2")
IF ResExec = True THEN
// Update bound controls with the values of the result
SQLAssociate("QRY2", CustName, Addr[1], Addr[2], City, ZipCode)
// Display the first one
SQLFirst("QRY2")
ELSE
// Processes the error
END
SQLClose("QRY2")
Example 3: Running a query and retrieving information about this query
This example is used to get information about the query run.
// Run the controls and retrieve the information
SQLExec("SELECT* FROM INV", "QRY1")
SQLInfo("QRY1")
IF ResExec = False THEN
Info("Error while running the query: " + SQL.MesError)
ELSE
Info("Number of columns: " + SQL.NbCol)
END
SQLClose("QRY1")
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