Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.5   10.0   10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2    Statistic    FMM    Blog  

SQL.SetCommandText

Sets the command text.

Component Version macOS Windows Linux Server iOS SDK
SQL 2.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "SQL.SetCommandText"; Command; CommandText { ; CommandType } )   More

Parameters

Parameter Description Example Flags
Command The command reference number gained with SQL.NewCommand. $Command
CommandText A string that represents command text string (an SQL statement or a stored procedure name). "SELECT * FROM MyTable"
CommandType Type of command. Can be CmdUnknown, CmdSQLStmt, CmdSQLStmtRaw or CmdStoredProc. CmdUnknown is default. "CmdSQLStmtRaw" Optional

Result

Returns "OK" or error message.

Description

Sets the command text.

Use SQL.SetCommandText method to set the command text. Command text can also be set in SQL.NewCommand.

It's not necessary to set a command type explicitly, because it is defined automatically in terms of command text string. But if you still have any reason to do it, use one of the following values:
CmdUnknownCommand type is not defined. Library will detect command type automatically when needed.
CmdSQLStmtCommand is an SQL statement.
CmdSQLStmtRawCommand is an SQL statement that mustn't be interpreted by SQLAPI++.
CmdStoredProcCommand is a stored procedure or a function.

To get command type use SQL.CommandType method.

If the command is an SQL statement and it has parameters, a set of parameter objects creates implicitly.

See also

Created 18th August 2014, last changed 13th January 2015


SQL.SetCommandTag - SQL.SetConnectionOption

Feedback: Report problem or ask question.