Use Windows.pkg Use cHtmlHelp.pkg Use cApplication.pkg Use sql.pkg Object oHtmlHelp is a cHtmlHelp End_Object Object oApplication is a cApplication Set pbPreserveEnvironment to False Set peHelpType to htHtmlHelp End_Object Handle hoSQLMngr Object oSQLManager is a cSQLHandleManager Move Self to hoSQLMngr End_Object // oSQLManager Function DriverIndex String sDriver Returns Integer String sCurrentDriver Integer iDriver Integer iNumDrivers Get_Attribute DF_NUMBER_DRIVERS to iNumDrivers For iDriver from 1 to iNumDrivers Get_Attribute DF_DRIVER_NAME of iDriver to sCurrentDriver If (Uppercase(sDriver) = Uppercase(sCurrentDriver)) Begin Function_Return iDriver End Loop Function_Return 0 End_Function // DriverIndex Procedure SetUpMSSQLEnvironment Integer iDriverID Load_Driver "MSSQLDRV" Get DriverIndex "MSSQLDRV" to iDriverID Set_Attribute DF_DRIVER_SILENT_LOGIN of iDriverID to True // error 12293 is "Login unsuccessful" Send Ignore_Error of Error_Object_Id 12293 End_Procedure Procedure MainRoutine Handle hoConnection hoStatement Integer iFetchResult String sName sState Send SetUpMSSQLEnvironment // Bad connection string Get SQLConnect of hoSQLMngr "MSSQLDRV" "SERVER=NOSERVER;Trusted_Connection=yes;DATABASE=VDF15xExamples" to hoConnection If (hoConnection) Begin Get SQLOpen of hoConnection to hoStatement If (hoStatement) Begin Send SQLExecDirect to hoStatement "Select * from Customer" Repeat Get SQLFetch of hoStatement to iFetchResult If (iFetchResult <> 0) Begin Get SQLColumnValue of hoStatement 2 to sName Get SQLColumnValue of hoStatement 5 to sState Showln sName ", " sState End Until (iFetchResult = 0) Send SQLClose to hoStatement End Send SQLDisconnect to hoConnection End Else Begin // error 12293 is "Login unsuccessful" If (LastErr=12293) Begin Send Stop_Box "Login Unsuccessful" "Error" End Send Info_Box "Connection not good..." "Testing Connection" End End_Procedure Send MainRoutine