wwsql::Execute

Runs a SQL statement specified in cSQL or passed in as a parameter. This method returns the SQL error code, as well as error information in cErrorMsg, cErrorMsg2 and aErrors. Any connection errors are retried several times.

loSql = CREATEOBJECT("wwSQL")

loSQL.Connect("server=.;database=webstore;integrated security=true")

lnCount = loSql.Execute("select * from wws_items","TQuery") 
IF (lnCount < 0)
   ? "Error: " + loSql.cErrorMsg
   RETURN
ENDIF

browse nowait && Tquery
o.execute(lcSQL, lcCursorName, llStoredProcedure)

Return Value

SQL Result 0 - Still Pending 1 - OK -1 - Error. Check cErrorMsg and aErrors for full error info.

Parameters

lcSQL
Optional - SQL statement to execute

lcCursorName
Optional - name of the cursor to output results to. If not provided the cSqlCursor property is used.

llStoredProcedure
Set to to true if this is a stored procedure. .F. if not passed.

Remarks

The cSqlCursor property is returned to TSQLQuery after each call to Execute.

For wwAdoSql ExecuteNonQuery is required for calling Stored Procedures that don't return cursors and have OUT parameters. If you use Execute instead of ExecuteNonQuery() the OUT parameter will not be returned.


See also:

Class wwsql

© West Wind Technologies, 1996-2024 • Updated: 07/30/20
Comment or report problem with topic