Home | Sign in | English EN

This content has been translated automatically. Click here to view the French version.
  • Configuring the connection
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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.
  • 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.
HConnect is used to easily define a connection to a database. It is recommended to use the HDescribeConnection function and then the HChangeConnection function for:
  • 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.
WINDEVWEBDEV - Server codeReports and QueriesAjaxUser code (UMC)HFSQLHFSQL Client/ServerOLE DBNative Connectors (Native Accesses)
HConnect("Salaries", "", "", ...
"C:\My Documents\MyDatabase.mdb", "Microsoft.JET.OLEDB.4.0", hOReadWrite)
Windows Mobile
HConnect("salaries", "", "", "MyDatabase", "Microsoft.JET.OLEDB.4.0", hOReadWrite)
<Result> = HConnect(<Table name> [, <User> [, <Password> [, <Database> [, <OLE DB Server or Native Access> [, <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 (with quotes)
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 (with quotes)
User name that will be used to open the data file.
<Password>: Optional character string (with quotes)
Connection password (if this password exists).
<Database>: Optional character string (with quotes)
Full path of data source.
Windows Mobile Name of SQL Server CE or Oracle Lite database defined on Pocket PC.
<OLE DB Server or Native Access>: Optional character string or constant
Name of OLE DB provider or one of the following constants:
hAccessHF7Pseudo-connection to HFSQL Classic database
hAccessHFClientServerNative Access to HFSQL Client/Server database
hNativeAccessAS400Native AS/400 Access (optional module of WINDEV/WEBDEV)
hNativeAccessDB2Native DB2 Access (optional module of WINDEV/WEBDEV)
hNativeAccessInformixNative Informix Access (optional module of WINDEV/WEBDEV)
Versions 20 and later
New in version 20
Native MariaDB Access (optional module of WINDEV/WEBDEV)
hNativeAccessMySQLNative MySQL Access (optional module of WINDEV/WEBDEV)
hNativeAccessOracleNative Oracle Access (optional module of WINDEV/WEBDEV)
hNativeAccessOracleLiteNative Oracle Access (optional module of WINDEV Mobile)
hNativeAccessPostgreSQLNative PostgreSQL Access (optional module of WINDEV/WEBDEV)
hNativeAccessProgressNative Progress Access (optional module of WINDEV/WEBDEV)
Versions 16 and later
New in version 16
Native SQL Azure Access (optional module of WINDEV/WEBDEV supplied with Native SQL Server Access)
Versions 15 and later
New in version 15
Native Access to SQLite database (supplied with WINDEV/WEBDEV)
hNativeAccessSQLServerNative SQL Server Access (optional module of WINDEV/WEBDEV)
hNativeAccessSQLServerMobileNative SQL Server Access (optional module of WINDEV Mobile)
hNativeAccessSybaseNative Sybase Access (optional module of WINDEV/WEBDEV)
hNativeAccessXBaseNative xBase Access (supplied with WINDEV/WEBDEV)
hNativeAccessXMLNative XML Access (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
New in version 19
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
Windows Mobile The available constants are as follows:
hAccessHF7Pseudo-connection to HFSQL Mobile database
hNativeAccessOracleNative Oracle Lite Access (optional module)
hNativeAccessSQLServerNative SQL Server CE Access (optional module)
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 ..CtOLEDBProvider.
<Access>: Optional constant
Configures the type of access to the data file.
(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.
(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 depends on the native access 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"

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 a table is open when HConnect is called, the table is closed then reopened with the new connection parameters.
Business / UI classification : Business Logic
Component : wd260hf.dll
Minimum version required
  • Version 9
This page is also available for…

Server =
User = sa
Password = 777777777
BD = producao

PROCEDURE DB_Inicialize(TrueFalse)

Server, User, Password, BD is string

IF TrueFalse = True THEN

PathFile is string = fCurrentDir(fCurrentDrive()) +"\Nagyro.ini"

IF fFileExist(PathFile) = True THEN

Server = INIRead("Nagyro", "Server", "", PathFile)
IF ErrorOccurred THEN

User = INIRead("Nagyro", "User", "", PathFile)
IF ErrorOccurred THEN

Password = INIRead("Nagyro","Password", "", PathFile)
IF ErrorOccurred THEN

BD = INIRead("Nagyro", "BD", "", PathFile)
IF ErrorOccurred THEN


ConnNativa..Server = Server
ConnNativa..User = User
ConnNativa..Password = Password
ConnNativa..Database = BD
ConnNativa..Provider = hNativeAccessSQLServer
ConnNativa..Access = hOReadWrite
ConnNativa..ExtendedInfo = "Extended information"
ConnNativa..CursorOptions = hClientCursor

ok is boolean = HOpenConnection(ConnNativa)

IF ok = False


09 Feb. 2015