PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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 a SQL Server database via 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")
Notes:
  • If you own the two versions of Native SQL Server Connector, you have the ability to select the version to use. The Native Connector via DB-Library is used by default if it is installed on the computer ; otherwise, the Native Connector via SQLnCli is used. The H.SQLServerMode variable is used to force a mode via the following values:
    • 0 to force the Native Connector via SQLnCli.
    • 1 to force the Native Connector via SQLnCli if it is installed, otherwise the Native Connector via DB-Library will be used.
    • 2 to force the Native Connector via DB-Library.
      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 in parameter the text of the SQL query 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 initializes a browse such as SQLFirst/SQLCol.
  • 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 the query result. The browse performed in the query result is a 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 when 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 required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment