AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Administrar bases de datos / HFSQL / Funciones HFSQL
  • Example: Modifying some ODBC connection parameters
  • Example: Modifying some OLE DB connection parameters
HConnect (Example)
Example: Modifying some ODBC connection parameters
WINDEVCódigo de Usuario (UMC)
In this example, the company database is on Oracle. The programmer wants to run the tests of his program on an SQL Server database by using the ODBC access.
Without modifying the analysis, the connection parameters can be modified by HConnect
Remark: "ODBCSQLServer" is an ODBC data source declared in the ODBC data sources of Windows.
// Change the connection parameters
HConnect("Salaries", "", "", "ODBCSQLServer", hODBC, hOReadWrite)
// Equivalent syntax:
HConnect("Salaries", "", "", "ODBCSQLServer", "MSDASQL", hOReadWrite)
// Start looping through the "Salaries" table on SQLServer
HReadFirst("Salaries")
...
// Restore the use of connection on Oracle
HConnect("salaries", "")
// Open the "Salaries" table on Oracle
HOpen("Salaries")
Example: Modifying some OLE DB connection parameters
WINDEVCódigo de Usuario (UMC)
In this example, the company database is on Oracle. The programmer wants to run the tests of his program on a local Access database.
Without modifying the analysis, the connection parameters can be modified by HConnect
In the analysis, a default OLEDB connection was associated to the "Salaries" OLEDB table on Oracle. The properties of this connection are:
  • datasource: oracleserver
  • user: smith
  • password: toto
  • provider: MSDAORA
The new connection toward the Access database will have the following parameters:
  • datasource: "C:\My Documents\MyDatabase.mdb"
  • user: ""
  • password: ""
  • provider: "Microsoft.JET.OLEDB.4.0"
// Change the connection parameters
HConnect(Salaries, "", "", ...
"C:\My Documents\MyDatabase.mdb", ...
"Microsoft.JET.OLEDB.4.0", hOReadWrite)
// Start browsing the "Salaries" table on Access
HReadFirst(Salaries)
...
// Restore the use of connection on Oracle
HConnect(Salaries, "")
// Open the "Salaries" table on Oracle
HOpen(Salaries)
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local