PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

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
Dynamically changes the connection associated with a data file. The new connection must be known and defined during this change. This new connection will be used during the next opening of the data file.
This allows you to import a description of Oracle tables into the analysis and to use this description to work on data files in HFSQL format. See the detailed examples for more details.
Tips:
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
// Describe the new connection
HDescribeConnection("MyConnection", "", "", ...
"Server_SQLServer", "dbo", hOledbSQLServer, hOReadWrite, "")

// Establish the new connection
HOpenConnection("MyConnection")

// Specify that "Salaries" is using the new connection
HChangeConnection("Salaries", "MyConnection")

// Start browsing the "Salaries" table on SQLServer
HReadFirst("Salaries")
...
// Close the connection
HCloseConnection("MyConnection")

// Restore the use of connection on Oracle
HChangeConnection("Salaries", "")

// Open the "Salaries" table on Oracle
HOpen("Salaries")
Syntax
<Result> = HChangeConnection(<File Name> , <New Connection>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
<File Name>: Character string (with or without quotes)
Name of data file (defined in the analysis) for which the connection must be changed. This data file will be automatically closed in order for its connection to be modified.
If this parameter is set to "*", the process is applied to all known data files, regardless their origin (HFSQL, OLE DB, Native Access, ...).
This allows you to transform a HFSQL data file into an OLE DB data file for example.
This parameter can also correspond to the name of a group of files (or custom-folder) defined in the analysis (not available in Android and Android Widget).
<New Connection>: Character string (with quotes) or Connection variable
  • Name of connection to a database. This connection was defined in the data model editor or it was dynamically described by HDescribeConnection. If this parameter corresponds to an empty string (""), the initial connection is automatically used.
  • Name of Connection variable corresponding to the new connection to use.
Remarks
  • The connection must be known when running HChangeConnection. If the data file is not known when using HChangeConnection, the connection will be changed during the file declaration.
  • HChangeConnection automatically closes the data file (HClose) whose connection must be modified.
  • HChangeConnection does not open the data file or the connection. The connection defined by HChangeConnection will be used during the next opening of the data file.
Related Examples:
WD OLEDB Training (WINDEV): WD OLEDB
[ + ] This example presents the access to a database via OLE DB with the WLanguage functions.
The following topics are presented in this example:
1/ the independence between your applications and the database
2/ the connection via OLE DB
Summary of the example supplied with WINDEV:
This example explains how to create an application independent of the database used.
The same application with the same source code accesses a HFSQL file or an Access database via OLE DB.
According to this principle, your applications will be able to access all the available databases.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230hf.dll
Windows Mobile wp230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment