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.
  • Configuring the connection
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
Redefines one or more connection parameters via Native Connector (Access, SQL Server, MySQL or Oracle) or via an OLE DB access on a specific table or set of tables. Then, the tables are opened (or created if they do not exist). The specified test operation is run.
Remarks:
  • The new redefinition of the connection will be used until it is canceled by HConnect. It will be automatically canceled at the end of application.
  • By default, the connection characteristics are defined in the data model editor, for one or more tables.
Important
HConnect is used to easily define a connection to a database. It is advisable to use the HDescribeConnection function and then the HChangeConnection function to:
  • manage the advanced parameters available for some databases (cursors, transactions, ...),
  • handle a named connection.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
WEBDEV - Server codeAjaxHFSQLHFSQL Client/ServerOLE DBNative Connectors (Native Accesses)
HConnect("Salaires", "", "", ...
"C:\Mes Documents\MaBase.mdb", "Microsoft.JET.OLEDB.4.0", hOReadWrite)
Syntax
<Result> = HConnect(<Table name> [, <User> [, <Password> [, <Database> [, <OLE DB or Native Connector Server> [, <Access> [, <Test operation> [, <Optional information>]]]]]]])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error.
<Table name>: Character string
Name of the table (data file) to opened, and for which the connection must be redefined. If no other parameter is specified, the data file is re-initialized with the default parameters defined in the analysis.
  • If this parameter is equal to "*", the change will apply to all tables handled by the Native Connector (also called Native Access). In this case, all connection parameters must be specified.
  • If this parameter is equal to "*" and no other parameters are specified, all data files of all Native Connectors defined in the analysis are reset to the default parameters.
<User>: Optional character string
Username that will be used to open the data file.
<Password>: Optional character string
Connection password (if this password exists).
<Database>: Optional character string
Full path of data source.
<OLE DB or Native Connector Server>: Optional character string or constant
Name of the OLE DB provider or one of the following constants:
hAccessHF7Pseudo-connection to HFSQL Classic database
hAccessHFClientServerNative Connector to an HFSQL Client/Server database
hNativeAccessAS400Native AS/400 Connector (optional module of WINDEV/WEBDEV)
hNativeAccessDB2Native DB2 Connector (optional module of WINDEV/WEBDEV)
hNativeAccessInformixNative Informix Connector (optional module of WINDEV/WEBDEV)
Versions 20 and later
hNativeAccessMariaDB
New in version 20
hNativeAccessMariaDB
hNativeAccessMariaDB
Native MariaDB Connector (optional module of WINDEV/WEBDEV)
hNativeAccessMySQLNative MySQL Connector (optional module of WINDEV/WEBDEV)
hNativeAccessOracleNative Oracle Connector (optional module of WINDEV/WEBDEV)
hNativeAccessOracleLiteNative Oracle Connector (optional module of WINDEV Mobile)
hNativeAccessPostgreSQLNative PostgreSQL Connector (optional module of WINDEV/WEBDEV)
hNativeAccessProgressNative Progress Connector (optional module of WINDEV/WEBDEV)
Versions 16 and later
hNativeAccessSQLAzure
New in version 16
hNativeAccessSQLAzure
hNativeAccessSQLAzure
Native SQL Azure Connector (optional module of WINDEV/WEBDEV, supplied with Native SQL Server Connector)
Versions 15 and later
hNativeAccessSQLite
New in version 15
hNativeAccessSQLite
hNativeAccessSQLite
Native Connector to a SQLite base (supplied as standard with WINDEV/WEBDEV)
hNativeAccessSQLServerNative SQL Server Connector (optional module of WINDEV/WEBDEV)
hNativeAccessSQLServerMobileNative SQL Server Connector (optional module of WINDEV Mobile)
hNativeAccessSybaseNative Sybase Connector (optional module of WINDEV/WEBDEV)
hNativeAccessXBaseNative xBase Connector (supplied with WINDEV/WEBDEV)
hNativeAccessXMLNative XML Connector (supplied with WINDEV/WEBDEV)
hODBCOLE DB provider for ODBC (used to access an ODBC data source declared in the ODBC data sources of Windows)
hOledbAccess97OLE DB provider for Access 97
hOledbAccess2000OLE DB provider for Access 2000
hOledbAccess2007OLE DB provider for Access 2007
Versions 19 and later
hOledbAccess2010
New in version 19
hOledbAccess2010
hOledbAccess2010
OLE DB provider for Access 2010
hOledbDBase5OLE DB provider for dBase 5
hOledbExcel2007OLE DB provider for Excel 2007
hOledbExcel2000OLE DB provider for Excel 2000
hOledbExcel97OLE DB provider for Excel 97
hOledbLotus4OLE DB provider for Lotus 4
hOledbOracleOLE DB provider for Oracle
hOledbSQLServerOLE DB provider for SQL Server
OLE DB Caution: To use an OLE DB connection, you must:
  • install MDAC version 2.6 or later (setup performed by WINDEV/WEBDEV and when creating the setup program)
  • install the OLE DB provider corresponding to the database used.
    This parameter is returned by the CtOLEDBProvider property.
<Access>: Optional constant
Configures the type of access to the data file.
hOReadWrite
(default value)
The data file can be accessed in read/write. You have the ability to read the records and to write new records.
hOReadThe data file can be accessed in read-only. You only have the ability to read the records. No record can be added or deleted.
<Test operation>: Optional constant
Configure the type of operation that will be performed on the database to check the connection.
hHCreationIfNotFound
(Default value)
Checks the connection by opening or creating a data file (if the data file does not exist). This operation can be performed in hOReadWrite mode only.
hHOpenChecks the connection by opening a data file. This value is used by default when accessing a database of type hORead.
<Optional information>: Optional character string
Information about the database. This information may vary depending on the Native Connector used.
Information inserted into the string for connecting to the database. For example, some data sources allow you to specify the database that will be used. With SQLServer, the "Master" database is the default database but other databases can be used, "dbo" for example. This information is specified in the <Optional information> parameter via the following syntax:
OLE DB "initial catalog = dbo"
ODBC "database = dbo"
Native Connectors (Native Accesses) MySQL: "initial catalog = dbo"
Remarks

Configuring the connection

  • The table description must be known during the call to HConnect (the table must have been described in the analysis, or by HDeclare or HDescribeFile).
  • HConnect opens the connection and the table. The table is created if it does not exist. For this specific point, HConnect is equivalent to HCreationIfNotFound.
  • When redefining the connection, only the specified parameters are taken into account. The value of parameters not specified by HConnect corresponds to the value defined in the data model editor.
  • If only the <Table name> is specified, HConnect cancels the connection redefinition for the specified tables. The parameters specified in the data model editor will be applied.
  • When the <Table name> parameter is equal to "*", the change applies to all the Native Connector tables defined in the analysis. In this case, only the <User>, <Password>, <Database> and <Access> parameters are taken into account.
  • To cancel a connection change performed on the tables, <Table name> must be equal to "*" and no other parameter must be specified.
  • If the data source is specified, HConnect ignores the possible HSubstDir/HChangeDir.
  • If an table is opened when the HConnectfunction is called, the table is closed and then re-opened with the new connection parameters.
Business / UI classification: Business Logic
Component: wd270hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment