PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • Programming
  • 1. Establishing the connection
  • 2. Running queries
  • 3. Retrieving the result
  • 4. Closing the connection
  • SQL Azure
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
Native SQL Server Connector: Programming with SQL functions
HFSQLHFSQL Client/ServerNot available with these kinds of connection
Overview
No matter whether WDSQSINS.EXE is used or not to configure the accessed database, the SQL functions can be used to handle the SQL Server database. For more details on WDSQSINS, see Configuring the connection with WDSQSINS.
Programming

1. Establishing the connection

SQLConnect opens a connection to an SQL Server database via the Native Connector. The type of database used, SQL Server in this case, must be passed as parameter to SQLConnect.
The database name corresponds to:
  • the name defined in WDSQSINS.
  • the name of the SQL Server server (or its alias).
    ConnectionNum = SQLConnect("SQLServerDatabase", "", "", "", "SQL SERVER")
Remarks:
  • By default, the installed version of the Native SQL Server Connector is used. If you have installed both the Native SQL Server Connector via OLE DB and via ODBC, the Native Connector via OLE DB will be used. You can select the version to use. The H.SQLServerMode variable is used to force a mode via the following values:
    • 0 to force the Native SQL Server Connector via OLE DB.
    • 3 to force the Native SQL Server Connector via ODBC.
    This variable must be modified before using SQLConnect.
  • SQL Azure: If the server name has the following format: ServerName.database.windows.net, the login must have the following format: login@ServerName.

2. Running queries

The queries are run by SQLExec. SQLExec expects the text of the SQL query as parameter, as well as the name that will be given to this query.
SQLExec("SELECT LASTNAME, FIRSTNAME, EXTENSION, PHOTO FROM CUSTOMER", "QRY1")

3. Retrieving the result

Several methods can be used to retrieve the result:
  • SQLFirst: Used to retrieve the result and initialize an SQLFirst/SQLCol iteration.
  • SQLTable: Retrieves the result of the query in a Table control populated programmatically in the WINDEV application. The result of the query can be retrieved by partial Fetch.
  • SQLFetch: Used to read the different lines of the query result. The iteration performed in the query result is an SQLFetch/SQLGetCol iteration.
SQLLock is used to lock the records found in the table or the records selected by the query.

4. Closing the connection

SQLClose is used to close the connection to the database once all the necessary queries have been run.

SQL Azure

SQL Azure requires the presence of a "clustered index" in the data files.
If you create the data files with SQL queries or to add a clustered index to an existing data file, see the documentation of SQL Azure to find out the syntax to use.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment