wwsql::ExecuteStoredProcedure

Calls a stored procedure.

o.ExecuteStoredProcedure(lcProcedure,lcCursor)

Return Value

.T. or .F.

Parameters

lcProcedure

lcCursor
Optional name for a cursor result set if returned.

Example

oSql = CREATEOBJECT("wwSql")

* driver={sql server};server=(local);database=WebStore
? oSQL.Connect("database=WebStore")

*** Parameters to pass
pnId=-1
pcTable = "wws_tlineitems"

*** Set parameters to pass to the SP
oSQL.AddParameter("wws_tlineitems","pcTable")
oSQL.AddParameter(0,"pnId","OUT")

IF !oSQL.ExecuteStoredprocedure("sp_ww_newId")
 ? oSQL.cErrorMsg
 RETURN
ENDIF

***Grab the return value
? oSQL.oParameters["pnId"].Value

You can also return cursor results and capture them to the cursor specified in the second parameter:

IF !oSQL.ExecuteStoredprocedure("sp_get_popular_posts","TPosts")
 ? oSQL.cErrorMsg
 RETURN
ENDIF

* TPosts cursor
BROWSE

See also:

Class wwsql

© West Wind Technologies, 2023 • Updated: 09/05/16
Comment or report problem with topic