Tech Tip: Connecting and Disconnecting to a database using 4D ADO Plugins
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Win
Published On: November 4, 2004
In 2004, 4D introduce a new plugin called "4D for ADO" providing developers a programming interface to access data in most relational database management systems that run on Windows systems. The following code below shows an example of connecting and disconnecting to a database using the new ADO plugin through ODBC.
C_TEXT($ConnStr)
C_LONGINT($ConnID)
` --- ADO using ODBC---
$ConnStr:="Driver={driver_name};"
$ConnStr:=$ConnStr+"Server=server DNS;"
$ConnStr:=$ConnStr+"Database=database_name;"
$ConnStr:=$ConnStr+"Uid=user_id;"
$ConnStr:=$ConnStr+"Pwd=password"
` Connect to database using the following parameters above
$ConnID:=DBGateway_Connect ("server DNS";$ConnStr)
`Disconnect from database
DBGateway_Close ($ConnID)