wwBusinessObject::Execute

Executes a fully qualified raw SQL statement against the database depending on the nDataMode. Can be used for any backend data command using either VFP syntax or SQLExec() style SQL commands and is meant to return a result set.

o.Execute(lcSQL, lcCursor)

Return Value

Record count or 0. Check .lError for any hard errors.

Parameters

lcSQL
Raw SQL command to be executed by the data engine. This can be any command the backend will understand. For VFP data this means any VFP command that can be macro'd. For SQL Server any Transact SQL command.

lcCursor
Optional - a cursor name for the resulting data set or data sets. If not specified .cSqlCursor is used for the cursor name. If the cursor is open it will be overwritten.

Important: FoxPro mode (nDataMode=1) ignores the lcCursor parameter and needs to specify cursor output explicitly (via INTO CURSOR or other commands). If you're using SELECT statements here, you can probably use the .Query() method instead which fixes up SQL SELECT commands.

Remarks

You can pass multi-line SQL statements without ; at the end of each line and this method will flatten the SQL statement to a single line when executing against the FoxPro data engine. This is useful for creating SQL Commands as strings in TEXT/ENDTEXT blocks.


See also:

Class wwBusinessObject

© West Wind Technologies, 1996-2024 • Updated: 04/16/21
Comment or report problem with topic