Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter EightData Functions (continued)

ODBCConnect Function

Overview

The ODBCConnect function establishes a connection with a host server and returns an ODBC Connection Object handle.

Syntax/Parameters

Syntax

handle = ODBCConnect ( string data );

Parameters

data

A string that contains data parameters including the source name for the driver connection. It usually contains a series of parameters specific to the host connection. See Remarks section for more details.

Return Value

Returns a handle to an ODBC Connection Object or NULL_HANDLE on failure. Use the GetLastError to retrieve error information. The GetLastErrorMessage function will generally return error details specific to the ODBC driver being employed.

Remarks

In order to establish an ODBC connection, the Windows ODBC Data Source Administrator must be run to setup a driver that provides a link to the host. See the discussion at the start of this section for more information.

The data string is a series of command parameters starting with the driver designation and followed by parameters specific to the host connection. For example:

Driver=Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb);Dbq=D:\Data\MyExcel.xlsx

The ‘Driver’ parameter must match exactly one of the drivers located in the ODBC Data Source Administrator panel. For example:

The driver can also be referenced by the name:

DSN=Excel Files;Dbq=D:\Data\MyExcel.xlsx

See MSDN and specific database implementation documentation for more information.

Executing this function may result in queries being directed to the user if the connection is not setup correctly or if a connect to the database server cannot be negotiated.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE