PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

  • Example: Initializing and browsing a SQL query
  • Example: Connecting to a SQL Server database and running a query
HExecuteSQLQuery (Example)
Example: Initializing and browsing a SQL query
WEBDEV - Server codePHPAjaxHFSQLHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses) The following example is used to initialize a query and to browse it. This example is using the Data Source type to handle the query.
MyQuery is Data Source
// Initializes the query
IF NOT HExecuteSQLQuery(MyQuery, ...
"SELECT LASTNAME,FIRSTNAME FROM CUSTOMER WHERE CUSTOMER.LASTNAME = 'SMITH'") THEN
Error("Error while initializing the query" + CR + HErrorInfo())
RETURN
END
 
// Read the first record of the query
HReadFirst(MyQuery)
WHILE NOT HOut()
  // Process on the query record
  // Access to the items via MyQuery.<Item Name>
  ...
  // Read the next record
  HReadNext()
END
Example: Connecting to a SQL Server database and running a query
WEBDEV - Server codePHPAjax
QryCustomer is Data Source
IF NOT HDescribeConnection("MyConnection", "sa", "","NATIVESQL", "", ...
hNativeAccessSQLServer, hOReadWrite) THEN
    Error(HErrorInfo())
ELSE
    // Open the connection
    HOpenConnection("MyConnection")
    HourGlass()
    // Run the query
    IF HExecuteSQLQuery(CustomerQry, "MyConnection", hQueryDefault, ...
"SELECT * FROM Store") THEN
      // Browse the result
      HReadFirst(CustomerQry)
      IF NOT HOut(CustomerQry) THEN
        FileToMemoryTable(TABLE_MyTable, ...
CustomerQry)
      END
    END
    HourGlass(False)
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment