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)

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

lcCursor
Name of the cursor to output results to. If not provided the cSqlCursor property is used.

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-2019 • Updated: 02/17/19
Comment or report problem with topic