« Greetings from FileMa… | Home | MBS Filemaker Plugin,… »

ExecuteSQL and getting error details


If you like to use SQL queries in FileMaker for a built in database, you normally use ExecuteSQL function. Now if you run something like this:

ExecuteSQL ( "select * from MyTable"; " "; ¶ )

Now if there is no table with that name of an other SQL error, you get back a ? as result. Not helpful.

Now if you switch to FM.ExecuteSQL or FM.ExecuteFileSQL function in MBS Plugin, you can use FM.ExecuteSQL.LastErrorMessage to get error message.

So if you run

MBS( "FM.ExecuteSQL";"select * from Contacts" )

and also query error with:

MBS( "FM.ExecuteSQL.LastError" )
MBS( "FM.ExecuteSQL.LastErrorMessage" )

you may get error "8309" with error message "ERROR: FQL0002/(1:14): The table named "Contacts" does not exist.". This should be more useful to locate the error.
25 10 14 - 00:02