PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Syntax 1: Opening a preset connection: automatic management of connections
  • Syntax 2: Using a character string for the OLE DB provider
  • Syntax 2 and 3: If a failure occurs, the connection description is not stored
  • Pseudo-connection to HFSQL Classic database
  • Differences between HOpenConnection and HDescribeConnection
  • UDL file (file for describing an OLE DB connection)
  • Native Oracle access: managing the external authentication
  • Limitations
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
Opens a connection to a specific database. The connection remains opened until the call to HCloseConnection. HOpenConnection is used to:
  • open a preset connection.
  • define and open a connection. Then, this connection must be assigned to a file by HChangeConnection.
  • define and open a connection by using a connection string. This syntax can be used with some OLE DB providers who have specific ADO connecting strings.
    Windows MobilePHP This option is not available.
    Java Access by JDBC: This option is not available.
  • open a connection defined by a Connection variable.
Caution: The order in which the functions for connecting to a HFSQL Client/Server database are called is important. See Optimizing the connection times to the HFSQL Client/Server databases for more details.
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
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.
Universal Windows 10 App This function can only be used to handle HFSQL Client/Server connections.
New in version 18
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.
Universal Windows 10 App This function can only be used to handle HFSQL Client/Server connections.
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.
Universal Windows 10 App This function can only be used to handle HFSQL Client/Server connections.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
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.
Reports and QueriesWindowsLinuxWindows MobileUniversal Windows 10 AppJavaAjaxUser code (UMC)HFSQLHFSQL Client/ServerOLE DBNative Accesses
MyConnection is Connection
// Describe the connection
MyConnection..User = "USER"
MyConnection..Password = "PASSWORD"
MyConnection..Server = "MYSERVER"
MyConnection..Database = "Database"
MyConnection..Provider = hAccessHFClientServer
MyConnection..Access = hOReadWrite
MyConnection..ExtendedInfo = "Extended information"
MyConnection..CursorOptions = hClientCursor

HOpenConnection(MyConnection)
Syntax

Opening a preset connection Hide the details

<Result> = HOpenConnection(<Connection Name>)
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred (during a connection described by programming, some parameters used in HDescribeConnection may be incorrect for example).
HErrorInfo is used to identify the error.
<Connection Name>: Character string (with or without quotes) or Connection
Name of connection to a database. This connection was defined:

Defining and opening a connection Hide the details

<Result> = HOpenConnection(<Connection Name> , <User Name> [, <Password>] , <Data Source> [, <Database>] , <OLE DB Provider or Native Access> [, <Access> [, <Extended Information> [, <Additional Options>]]])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error. To assign this connection to a file, use HChangeConnection. The connection description will be deleted when closing the connection.
<Connection Name>: Character string (with quotes)
Name of new connection to define and to open. This name must not be used by another connection (defined in the analysis, or by HOpenConnection or HDescribeConnection).
This parameter corresponds to ..Name used on a Connection variable.
<User Name>: Character string (with quotes)
User name that will be used for the database. This parameter can be modified and retrieved via ..User used on a Connection variable.
<Password>: Optional character string (with quotes)
Connection password (if this password exists). If no password is required, use an empty string ("") or the NULL keyword. This parameter can be modified via ..Password used on a Connection variable.
<Data Source>: Character string (with quotes)
Full path of data source. The connection will be created and opened for this data source.
This parameter can be retrieved and modified via ..Source (or ..Server) used on a Connection variable.
HFSQL Client/Server This parameter corresponds to the server name. The port number used by the HFSQL server can be specified. The port 4900 will be used by default. If the port number of the HFSQL server is different, use the following notation:
<Computer Name>: <Port Number>
Example: "ComputerName:4901".
For a use via Internet, the ports must be managed by Firewall. See Managing ports for more details.
Versions 15 and later
You have the ability to specify an IPv6 address by writing the IPv6 address between square brackets. In this case, the port number must be specified after the closing square bracket. For example: [0154:2145:2155::5554]:4900.
New in version 15
You have the ability to specify an IPv6 address by writing the IPv6 address between square brackets. In this case, the port number must be specified after the closing square bracket. For example: [0154:2145:2155::5554]:4900.
You have the ability to specify an IPv6 address by writing the IPv6 address between square brackets. In this case, the port number must be specified after the closing square bracket. For example: [0154:2145:2155::5554]:4900.
Java Access by JDBC:
  • This parameter must correspond to URL of the connection to the database. This URL is specific to each driver.
  • Depending on the JDBC driver used, the database name must be specified in the connection URL.
AndroidAndroid Widget
Versions 18 and later
For a connection to a HFSQL Client/Server database found on the development computer from an Android emulator, you must use the IP address 10.0.2.2 with the server port. Example: "10.0.2.2:4900".
For a connection to a HFSQL Client/Server database found on the network of the development computer from an Android emulator, you must use the full name of the server with the domain ; however, with the WINDEV Mobile simulator, the computer name without domain may be sufficient. Example: "Server@domain.com:4900".
New in version 18
For a connection to a HFSQL Client/Server database found on the development computer from an Android emulator, you must use the IP address 10.0.2.2 with the server port. Example: "10.0.2.2:4900".
For a connection to a HFSQL Client/Server database found on the network of the development computer from an Android emulator, you must use the full name of the server with the domain ; however, with the WINDEV Mobile simulator, the computer name without domain may be sufficient. Example: "Server@domain.com:4900".
For a connection to a HFSQL Client/Server database found on the development computer from an Android emulator, you must use the IP address 10.0.2.2 with the server port. Example: "10.0.2.2:4900".
For a connection to a HFSQL Client/Server database found on the network of the development computer from an Android emulator, you must use the full name of the server with the domain ; however, with the WINDEV Mobile simulator, the computer name without domain may be sufficient. Example: "Server@domain.com:4900".
For a connection to a SQLite database: full path of the file containing the SQLite database on the Android device.
Example : /sdcard/bdd/MyDatabase.db
If the parameter corresponds to an empty string (""), the file containing the database data will be created in the "databases" directory of application and its name will be identical to the application name followed by the ".db" extension.
<Database>: Optional character string (with quotes)
Name of database that will be used on the data source. If this parameter is not required, use an empty string ("").
This parameter can be retrieved and modified via ..Database used on a Connection variable.
This database will be automatically created if it does not exist.
<OLE DB Provider or Native Access>: Character string or constant
  • Name of OLE DB provider used. To easily retrieve the string to use, select "Connection" in the data model editor (see the Notes).
    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
    hNativeAccessMariaDB
    New in version 20
    hNativeAccessMariaDB
    hNativeAccessMariaDB
    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
    hNativeAccessSQLAzure
    New in version 16
    hNativeAccessSQLAzure
    hNativeAccessSQLAzure
    Native SQL Azure Access (optional module of WINDEV/WEBDEV supplied with Native SQL Server Access)
    Versions 16 and later
    hNativeAccessSQLite
    New in version 16
    hNativeAccessSQLite
    hNativeAccessSQLite
    Native SQLite Access (supplied with WINDEV/WEBDEV)
    hNativeAccessSQLServerNative SQL Server Access (optional module of WINDEV/WEBDEV)
    The former Native Access is used by default. To force the use of new Native SQL Server Access, use the H.SQLServerMode variable.
    hNativeAccessSQLServerMobileNative SQL Server Mobile 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
    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

    Windows Mobile The available constants are as follows:
    hAccessHF7Pseudo-connection to HFSQL Mobile database
    hAccessHFClientServerConnection to HFSQL Client/Server database
    hNativeAccessOracleNative Oracle Lite Access (optional module)
    hNativeAccessSQLServerMobileNative SQL Server Mobile Access (optional module)

    AndroidAndroid Widget The available constants are as follows:
    Versions 15 and later
    hNativeAccessSQLite
    New in version 15
    hNativeAccessSQLite
    hNativeAccessSQLite
    Native SQLite access for the Android applications.

    Java The available constants are as follows:
    hAccessHF7Pseudo-connection to a HFSQL database
    hAccessHFClientServerConnection to HFSQL Client/Server database
    hAccessJDBCMySQLAccess to MySQL database via JDBC
    Versions 15 and later
    hAccessJDBCSQLite
    New in version 15
    hAccessJDBCSQLite
    hAccessJDBCSQLite
    Access to SQLite database via JDBC
    hAccessJDBCSQLServerAccess to SQL Server database via JDBC
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 client version)
  • install the OLE DB provider corresponding to the database used.
    This parameter is returned by ..CtOLEDBProvider.
PHP This parameter can correspond to one of the following constants:
hNativeAccessAS400Native AS/400 Access (optional module of WEBDEV)
Versions 20 and later
hNativeAccessMariaDB
New in version 20
hNativeAccessMariaDB
hNativeAccessMariaDB
Native MariaDB Access (optional module of WINDEV/WEBDEV)
hNativeAccessMySQLNative MySQL Access (optional module of WEBDEV)
Versions 15 and later
hNativeAccessOracle
New in version 15
hNativeAccessOracle
hNativeAccessOracle
Native Oracle Access (optional module of WEBDEV)
Versions 15 and later
hNativeAccessPostgreSQL
New in version 15
hNativeAccessPostgreSQL
hNativeAccessPostgreSQL
Native PostgreSQL Access (optional module of WEBDEV)
This parameter can be retrieved and modified via the ..Provider property used on a Connection variable.
<Access>: Optional constant
Configures the type of access to the database.
hOReadWrite
(default value)
The database can be accessed in read/write. You have the ability to read the records and to write new records.
hOReadThe database can be accessed in read-only. You only have the ability to read the records. No record can be added or deleted.
HFSQL Client/Server This constant is ignored.
This parameter can be retrieved and modified via the ..Access property used on a Connection variable.
Java Access by JDBC: This parameter is ignored.
PHP This parameter is not available.
<Extended Information>: Optional character string (with quotes)
Optional information inserted into the string for connecting to the database. If specific keywords are recognized, the corresponding information is extracted from the connection string. The rest of the connection string is sent to the database. Then, the extracted parameters are processed by the native access or by the OLE DB access used.
These keywords must be indicated as follows: "<Keyword> = <Value>;".
You can for example specify "Trusted_Connection=YES" in order to use a connection with authentication via the NT login.
OLE DBNative Accesses The keywords recognized by OLE DB and the native accesses are presented in the page named Optional connection information.
Example of string to use:
"WD Cache Size = 10000; Server Port=3306;"
HFSQL Client/Server Keywords recognized for the access by HFSQL Client/Server:
COMPRESSIONEnables or disables the compression of the data sent between the Client and the Server. This keyword can correspond to:
  • TRUE to enable the data compression.
  • FALSE to disable the data compression.
ENCRYPTIONEnables the encryption of data exchanged between the Client and the Server.
This keyword can take two values:
  • FAST
  • RC5_16 for a RC5 encryption (16 rounds).
DB_EXISTChecks the existence of the database. If the specified database does not exist, this database is not created and HOpenConnection returns False.
This parameter can be retrieved and modified by ..ExtendedInfo.
Java HFSQL database accessed via a RMI server: This parameter corresponds to the address of RMI server and to the port used. The following format must be used: "RMI=<Server Address>:<Port Number>". For example: "RMI=192.168.52.148:1099".
Java Access by JDBC: This parameter is mandatory. It must correspond to the full name of JDBC driver to use. This name is case sensitive.
PHP This parameter is not available.
<Additional Options>: Optional constant
If this parameter is not specified, the HFSQL engine automatically defines the best parameters to use according to the database accessed and to the OLE DB provider used.
By default, this parameter corresponds to the following combination of constants:
hServerCursor + hOpenKeysetCursor + hOptimisticCursor
However, these parameters can differ according to the information returned by the database.
To force some parameters, you have the ability to combine the following constants:
  • Location of cursors
    hClientCursorCursor managed by MDAC. Offers more features than a server cursor. A client cursor must necessarily be a static cursor.
    hServerCursorCursor managed by the database. This cursor can easily apply the changes performed by the other users to the data.
  • Type of cursor
    hDynamicCursorCursor offering a lot of features but consuming a lot of memory. This cursor allows all types of moves. It allows you to access all the modifications, additions and deletions performed by the other users.
    hForwardOnlyCursorFast cursor consuming little memory. The move is performed from the first record to the last one. The data modified by the other users is not visible.
    hOpenKeysetCursorCursor that handles a fixed set of records. Only the keys corresponding to the record are stored and not the records (consumes less memory). The deleted records can no longer be accessed. The modifications performed by the other users are visible (but not the additions).
    hStaticCursorRetrieves a copy of all the query records in memory (consumes a lot of memory). All types of moves are allowed.
  • Lock mode
    hReadOnlyCursorThe set of records cannot be modified.
    hOptimisticCursorThe record is locked when it is updated
    hPessimisticCursorThe record is locked as soon as it becomes in edit to be modified.
Caution: some types of cursors may not be supported by all the OLE DB providers.
This parameter can be retrieved and modified by ..CursorOptions.
Windows Mobile This parameter is ignored.
PHP This parameter is not available.
WINDEVWEBDEV - Server codeReports and QueriesAjaxUser code (UMC)

Defining and opening a connection by defining the connection string Hide the details

<Result> = HOpenConnection(<Connection Name> , <ADO Connection String> [, <Access>])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HErrorInfo is used to identify the error. The connection description will be deleted when closing the connection.
<Connection Name>: Character string (with quotes)
Name of new connection to define and to open. This name must not be used by another connection (defined in the analysis, or by HOpenConnection or HDescribeConnection).
<ADO Connection String>: Character string (with quotes)
ADO connection string to use. See the documentation supplied by the OLE DB provider for more details.
<Access>: Optional constant
Configures the type of access to the database.
hOReadWrite
(default value)
The database can be accessed in read/write. You have the ability to read the records and to write new records.
hOReadThe database can be accessed in read-only. You only have the ability to read the records. No record can be added or deleted.
Remarks
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppPHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerOLE DBNative Accesses

Syntax 1: Opening a preset connection: automatic management of connections

  • The connection associated with a file is automatically opened when the file is opened. The connection is closed when the last file using this connection is closed.
  • Any connection opened by HOpenConnection remains opened even if it is not used.
  • If the application performs several successive file opening and closing, the automatic management of connections will result in several opening/closing of connections, slowing down the application. In this case, we recommend that you use HOpenConnection to keep the connection opened.
WINDEVWEBDEV - Server codeReports and QueriesWindows MobilePHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerOLE DBNative Accesses

Syntax 2: Using a character string for the OLE DB provider

To easily find the character string that must be used to define the OLE DB provider, we recommend that you proceed as follows:
  1. In the data model editor, display the description window of the connection ("Analysis .. Connection")
  2. Select the provider to use ("Connect via" combo box).
  3. The character string corresponding to the provider is displayed. This character string can be used in the syntax 2 instead of constants.
WINDEVWEBDEV - Server codeReports and QueriesWindows MobilePHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerOLE DBNative Accesses

Syntax 2 and 3: If a failure occurs, the connection description is not stored

If the connection fails to open, the description of this connection is not validated. This allows you to redefine a connection with the same name.
For example, if the attempt to connect with the default password fails, you have the ability to perform a new attempt with another password.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileAjaxUser code (UMC)HFSQL

Pseudo-connection to HFSQL Classic database

OLE DB data files or native data files are described in the data model editor. To handle these descriptions with a HFSQL Classic database, all you have to do is specify the hAccessHF7 constant as provider name.
The data files in HFSQL Classic format corresponding to the description of the OLE DB or native files will be created (if necessary) in the directory defined by <Data Source>.

Differences between HOpenConnection and HDescribeConnection

Method 1: To open a connection at the beginning of application and to close it at the end, use HOpenConnection. To use this connection when handling files or tables, all you have to do is change this connection with HChangeConnection.
HOpenConnection(MyConnection, params) // Open the connection
HChangeConnection(AFile, MyConnection)
Method 2: To describe a connection by programming and to automatically open it when the file is opened, you must:
  • describe the connection with HDescribeConnection
  • associate this connection with the relevant file description with HChangeConnection. The connection will be established during the first access to the file.
This solution can be useful when an application is using both HFSQL files and Oracle files. For example, if the application is using a single Oracle file in a very specific process, the connection to the Oracle database will be established when it is required.
If the first solution is chosen for the same type of application, the connection (that may take quite a long time) will be established whenever the application is started.
Example:
HDescribeConnection(MyConnection, params)
HChangeConnection(AFile, MyConnection)
...
HReadFirst(AFile) // Open the connection
...
HClose(AFile) // Close the connection
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileAjaxUser code (UMC)OLE DB

UDL file (file for describing an OLE DB connection)

To create a UDL file:
  1. Create a text file whose extension is "UDL".
  2. Double-click this file. The window for the properties of the data links is opened.
  3. Configure the connection.
  4. Run the test of the connection.
  5. Validate ("OK" button). The UDL file can now be used.
Versions 18 and later
WINDEVWEBDEV - Server codeNative Accesses

Native Oracle access: managing the external authentication

To connect via an external authentication, the following connection parameters must be used:
  • <User name> = / (slash)
  • <Password> = "" (empty string)
Note: The external authentication consists in using the name of Windows user and his password to connect to the database. The external authentication requires a setting of the server. See the documentation about Oracle to find out how to authorize the external authentications on the server.
New in version 18
WINDEVWEBDEV - Server codeNative Accesses

Native Oracle access: managing the external authentication

To connect via an external authentication, the following connection parameters must be used:
  • <User name> = / (slash)
  • <Password> = "" (empty string)
Note: The external authentication consists in using the name of Windows user and his password to connect to the database. The external authentication requires a setting of the server. See the documentation about Oracle to find out how to authorize the external authentications on the server.
WINDEVWEBDEV - Server codeNative Accesses

Native Oracle access: managing the external authentication

To connect via an external authentication, the following connection parameters must be used:
  • <User name> = / (slash)
  • <Password> = "" (empty string)
Note: The external authentication consists in using the name of Windows user and his password to connect to the database. The external authentication requires a setting of the server. See the documentation about Oracle to find out how to authorize the external authentications on the server.

Limitations

  • WINDEVWEBDEV - Server codeReports and QueriesWindows MobilePHPAjaxUser code (UMC)HFSQLHFSQL Client/ServerOLE DBNative Accesses This function is not available when accessing a database via Remote Access.
  • AndroidAndroid Widget Only the hNativeAccessSQLite constant is available for Android.
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
HCS.Timeout & HCS.FrameSize
A variável HCS.Timeout é usada para modificar o tempo limite da conexão:
Para as conexões estabelecidas pelo HOpenConnection .
Para as aberturas de conexão automática.
Nota : A variável HCS.Timeout é ignorada para os acessos ao servidor que não seja a conexão. Um pedido cuja execução é maior do que o valor especificado na variável HCS.Timeout não seria interrompida, por exemplo. Esse tempo limite deve ser especificado no aplicativo cliente, antes que uma conexão seja aberta no servidor.
Exemplo

HCS.Timeout = INTRANET

A variável HCS.FrameSize é usada para redimensionar o quadro de dados de saída. Em alguns casos, o redimensionamento dos quadros pode ser usado para adaptar o fluxo de dados de saída e de entrada aos desempenhos do hardware usado. Por exemplo, se a conexão entre os computadores clientes e o mecanismo HFSQL Client / Server for através de redes de configuração (placa de rede, switch, roteador, vpn, ...)

HCS.FrameSize = hInternetFrame
BOLLER
Aug. 28 2017
In class, let's review the hyperfile connection.

Aula 1158 WinDev Curso ErpAmarildo 16 - Conexao Hyperfile


Nessa aula de hoje

Na aula de vamos , revisar a conexao hyperfile

In class, let's review the hyperfile connection.

En la clase de vamos, revisar la conexión hyperfile


http://windevdesenvolvimento.blogspot.com.br/2016/06/menu-blog.html

http://windevdesenvolvimento.blogspot.com.br/2015/04/windevwebdevmobile-hyperfile-instalar.html

https://doc.windev.com/en-US/?2028081&name=Hyper_File_CS_server

https://doc.windev.com/en-US/?3044107&name=HOpenConnection

https://doc.windev.com/en-US/?3044095&name=hcloseconnection_function

https://doc.windev.com/en-US/?3044150&name=HChangeConnection


http://windevdesenvolvimento.blogspot.com.br/2017/05/aula-1158-windev-curso-erpamarildo-16.html

https://www.youtube.com/watch?v=B87q726WBr4

De matos
May 24 2017
Exemplo de uso do driver nativo MS SQL SERVER
//Conexao
ok, ok1, ok2, ok3 is boolean

myConn is Connection
myConn..Provider = hNativeAccessSQLServer
myConn..User = "adriano"
myConn..Password = "adriano@2016"
myConn..Source = "192.168.0.162\projeto01"
myConn..Database = "projeto01"
myConn..Access = hOReadWrite

ok1 = HOpenConnection(myConn)
IF ok1 = False THEN
Info(ErrorOccurred() +" - "+ HErrorInfo())
END


IF gpwInitAnalysis() = False THEN
Error(ErrorInfo())
ok2 = False
ELSE

ok2 = True
IF gpwOpen() = gpwOk
ok3 = True
ELSE
Info(ErrorOccurred() +" - "+ HErrorInfo())
ok3 = False
END

END

NextTitle("Atenção")

IF ok1 = True AND ok2 = True AND ok3 = True THEN //deve dar tudo ok

Info("Conectou com sucesso no banco de dados!")

ELSE

Info("Falha ao tentar conectar no Servidor")

END
BOLLER
Nov. 28 2016
A more "real life" example
 The example lacks the function that actually let´s you open any file in the database, this function is HchangeConnection, so for me the example should be:

MyConnection is Connection
// Describe the connection
MyConnection..User = "admin"
MyConnection..Password = ""
MyConnection..Server = "Diego-PC"
MyConnection..Database = "Followup"
MyConnection..Provider = hAccessHFClientServer
MyConnection..Access = hOReadWrite
MyConnection..ExtendedInfo = "Extended information"
MyConnection..CursorOptions = hClientCursor
// Establish the connection
HOpenConnection(MyConnection)
HChangeConnection("*",MyConnection) <- This line is a must in order to open the files
Diego Sanchez
Mar. 20 2014