Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   Crossplatform   Server (Not)   Client   Components   Old   Guides
New in version: 5.0   5.1   5.2   5.3   5.4   6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1    Statistic  


Execute the SQL Statement against a FileMaker database.

Component: FM FMSQL
Version: 5.1
Mac OS X: Yes
Windows: Yes
Server: Yes
FileMaker Cloud: Yes

MBS( "FM.SQL.Execute"; FileName; SQL Statement { ; Params } )


Parameter Description Example value
FileName The target database name. Can be empty to not limit query to one database. ""
SQL Statement SQL Statement as a Text string
Params Optional
Optional, pass here parameters. One parameter to this function for each parameter you want to pass to the SQL statement.


Returns reference number or error.


Execute the SQL Statement against a FileMaker database.
This function requires FileMaker 11 or newer. Please use FM.ExecuteSQL on FileMaker 10 or older.
Returns a SQL Reference, so you can use functions like FM.SQL.RowCount, FM.SQL.FieldCount, FM.SQL.Field and FM.SQL.FieldType to query result. Don't forget to use FM.SQL.Release to release the result from memory when you are done with it.


Query only first row:

MBS( "FM.SQL.Execute"; ""; "SELECT * FROM ProductImages FETCH FIRST 1 ROWS ONLY")

SELECT records

MBS("FM.SQL.Execute"; ""; "select * from Contacts")

Select with parameter:

MBS("FM.SQL.Execute"; ""; "select Menge from Boxen where Artikel_Nr=? ORDER BY Menge DESC"; "ABC123")

Query some values:

Set Variable [$sql; Value:MBS( "FM.SQL.Execute"; ""; "select * from Clients")]
If [MBS("IsError")]
    Show Custom Dialog ["SQL error"; $sql]
    Show Custom Dialog ["SQL result"; "got " & MBS( "FM.SQL.RowCount"; $sql ) &" rows with each " & MBS( "FM.SQL.FieldCount"; $sql ) & " …"]
    Set Variable [$r; Value:MBS( "FM.SQL.Release"; $sql )]
End If

See also

FM.SQL.CSV   -   FM.SQL.Field

Feedback: Report problem or ask question.

MBS Real Studio PDF Plugins - Pfarrgemeinde Messdiener Nickenich