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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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. See Configuring the connection with WDSQSINS for more details.
Programming

1. Establishing the connection

SQLConnect is used to establish a connection to an SQL Server database via the Native Connector. The type of database used (SQL SERVER in this case) must be passed in 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.
  • Versions 16 and later
    SQL Azure: If the server name has the following format: ServerName.database.windows.net, the login must have the following format: login@ServerName.
    New in version 16
    SQL Azure: If the server name has the following format: ServerName.database.windows.net, the login must have the following format: login@ServerName.
    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 browse.
  • SQLTable: Used to retrieve the query result in a memory table of the WINDEV application. The result of the query can be retrieved by partial Fetch.
  • SQLFetch: Used to browse the different lines of query result. The browse performed in the query result is an SQLFetch/SQLGetCol browse.
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.
Versions 16 and later

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.
New in version 16

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.

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