DECLARE sp_send_dbmail PROCEDURE FOR sp_send_dbmail
@profile_name = :ls_Null,
@recipients = :ls_To,
@copy_recipients 开发者_C百科= :ls_Null,
@blind_copy_recipients = :ls_Null,
@subject = :ls_Null,
@body = :ls_Body,
@importance = :ls_Importance,
@rtn = :li_Rtn OUTPUT;
EXECUTE sp_send_dbmail;
I'm not sure why not, calling stored procs isn't traditionally a problem with PowerBuilder.
That code seems fine from what I can see of it.
After the execute check for SQLCA.SQLCode and SQLCA.SQLErrText to determine if there is an error. You can use something like:
if SQLCA.SQLCode <> 0 then
MessageBox("Error", "Error Code: " + String(SQLCA.SQLDBCode) + "~r~n" + &
"Error Message: " + SQLCA.SQLErrText)
end if
Declare Local External Functions on your transaction object. Open your custom transaction object, then go to Local External Functions tab.
Define your procedure or package.procedure calls like some of these examples:
// stored proc no package
SUBROUTINE SubRtnName(args) RPCFUNC
// function
long ll_rtn = FUNCTION FuncRtnVal(int li_arg) RPCFUNC
// standard proc with some in/out parameters
SUBROUTINE CalcAmount(string LS_In1, ref string LS_Out2) RPCFUNC
// package.procedure
SUBROUTINE SubRtnName(args) RPCFUNC ALIAS FOR "PackageName.ProcName"
// more complex package.procedure definition
SUBROUTINE CalcPenaltyAmt(string LS_In1, ref string LS_Out2[]) RPCFUNC ALIAS FOR "Penalty.P_Calc_Amount"
To call the procedures in code using the name defined after subroutine OR function name:
// call standard proc
SQLCA.SubRtnName(parms);
// call package.procedure
SQLCA.CalcPenaltyAmt('stingarg', ref ls_ref_string_array);
This assumes you have a non-visual transaction object defined and set as the SQLCA in your application object. Without a custom transaction object you cannot define external functions like this. The way you accomplish, is create a standard non-visual of type transaction, then in your application object in custom variables replace SQLCA with your n_tr_transaction.
精彩评论