project BLF > class Persistence (other) > method ConnectDB

Description

Connect a database


Parameters


icDBinputcharacterPhysical database name.
icConnectinputcharacterConnect parameters
ihClassinputhandleHandle to the class that is using the persistence layer. In most of the cases, this handle will be available in the preprocessor {&TARGETPROCEDURE}.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method other.MainBlock


program code (program2/other.p)

if vcUserId = ""
then do:
    <M-1 run MainBlock
          (input  icDB (icLogicalDbName), 
           output vcUserId (ocLogin), 
           output vcPassword (ocPassword)) in dbinfo>
    run gipr_DeleteProcedure in vhFcComponent.
    delete procedure vhFcComponent.
end.

run SqlConnect in {&TARGETPROCEDURE}
   (input icConnect,
    input icDB,
    input vcUserId,
    input vcPassword,
    output oiReturnStatus).
if oiReturnStatus <> 0
then do:
    <M-2 run SqlErrorMessage (input  ihClass (ihClass), 
                          output viFcReturnSuper (oiReturnStatus)) in other>
end.