server| process
To lock application resources (Sp_getapplock/sp_releaseapplock) as an example:
Sp_getapplock no return parameter (output type), only return value in SP
Lock
Dim cmd as Adodb.command
Set cmd = New adodb.command
Cmd. ActiveConnection = CNN
Cnn. BeginTrans
Cnn. Execute "Use master"
Cmd.commandtype = adCmdStoredProc
Cmd.commandtext = "Sp_getapplock"
The system identification format is: ' "{? = Call Sp_getapplock (?,?,?,?)} "
Cmd. Prepared = True
Cmd. Parameters (1) = name of "Lock name" resource lock
Cmd. Parameters (2) = "Exclusive"
Cmd. Parameters (3) = "Transaction"
Cmd. Parameters (4) = 0 ' to receive the value returned by the return keyword in the SP
Cmd. Execute
MsgBox cmd. Parameters (0) ' Display return value
Unlock:
Dim cmd as Adodb.command
Set cmd = New adodb.command
Cmd. ActiveConnection = CNN
Cmd.commandtype = adCmdStoredProc
Cmd.commandtext = "Sp_releaseapplock"
Cmd. Parameters (1) = "Lock name" Lock resource Name
Cmd. Parameters (2) = "Transaction"
Cmd. Execute
MsgBox cmd. Parameters (0)