PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

This content has been translated automatically. Click here to view the French version.
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
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. For more details, see the detailed examples.
Tips:
  • For handle connections, it is recommended to use an Variable type Connection.
  • Caution: The order in which the functions for connecting to an HFSQL Client/Server database are called is important. For more details, see .
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
// Décrire la nouvelle connexion
HDescribeConnection ("MaConnexion", "", "", ...
"Serveur_SQLServer", "dbo", hOledbSQLServer, hOReadWrite, "")
 
// Ouvrir la nouvelle connexion
HOpenConnection("MaConnexion")
 
// Indiquer que "Salaires" utilise la nouvelle connexion
HChangeConnection("Salaires", "MaConnexion")
 
// Commencer le parcours de la table "Salaires" sur SQLServer
HReadFirst("Salaires")
...
// Fermer la connexion
HCloseConnection("MaConnexion")
 
// Rétablir l'utilisation de la connexion sur Oracle
HChangeConnection("Salaires", "")
 
// Ouvrir la table "Salaires" sur Oracle
HOpen("Salaires")
Syntax
<Result> = HChangeConnection(<Data file> , <New connection>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
<Data file>: Character string
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 Connector, etc.).
This allows you to transform an 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 or Connection variable
New connection to use. This parameter can correspond to:
  • the name of the connection to a database. This connection was defined in the data model editor or dynamically with HDescribeConnection. If this parameter corresponds to an empty string (""), the initial connection is automatically used.
  • the name of the Connection variable that corresponds 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.
  • The HChangeConnection function does not open the data file or the. The connection defined by the HChangeConnection function will be used the next time of the data file is opened.
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.
Component: wd270hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment