SQL.CommandText
---------------

Gets the command text associated with the command object.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SQL](component_SQL.md) | [2.6](newinversion26.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "SQL.CommandText"; Command ) 

**MBS**( **"SQL.CommandText";** /\* Gets the command text associated with the command object. \*/  
**$Command**) /\* The command reference number gained with [SQL.NewCommand](SQLNewCommand.md). \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Command | The command reference number gained with [SQL.NewCommand](SQLNewCommand.md). | $Command |

### Result

The command text or error message.

### Description

Gets the command text associated with the command object.  
### Examples

Query command:

 Set Variable \[ $con ; Value: MBS ( "[SQL.NewConnection](SQLNewConnection.md)" ) \]   
Set Variable \[ $cmd ; Value: MBS ( "[SQL.NewCommand](SQLNewCommand.md)"; $con ; "SELECT \* FROM Table" ) \]   
Show Custom Dialog \[ MBS ( "SQL.CommandText"; $cmd ) \]  
### See also

- [SQL.CommandType](SQLCommandType.md)
- [SQL.NewCommand](SQLNewCommand.md)
- [SQL.NewConnection](SQLNewConnection.md)
- [SQL.SetCommandText](SQLSetCommandText.md)

This function is free to use.

Created 18th August 2014 , last changed 25th November 2017

  
[SQL.Close](SQLClose.md) - [SQL.CommandType](SQLCommandType.md)

[HTML Version](SQLCommandText.shtml)