Having VCL or ActiveX Edition of Active Query Builder, you may assign SQL query text to the QueryBuilder.SyncSQL property in a try-except (try-catch) block.

try
acQueryBuilder.SQL:='select * from Orders';
except
on e:EacSQLError do
ShowMessage('Unexpected token "'+e.ErrorTokenValue+'" in line '+IntToStr(e.ErrorPos.line);
end;

Please note that Active Query Builder does not perform validation against specific database context, i.e. presence of table fields, function parameters, constants, etc. We believe that the best and only possible validator is the database server itself.

The fastest way to do that is to execute the query without data retrieval by calling the following method:

SqlCommand.ExecuteReader(CommandBehavior.SchemaOnly).

Of course, you can check if such database objects and fields are present in the database (using the QueryBuilder.QueryStatistics set of collections), but still, there are many things we can recognize regarding the correctness of a query for execution against a particular database.

You can instruct the component to generate parsing error for queries with unknown database objects using the QueryBuilder.ParsingErrorOnUnknownObjects property

Active Query Builder can parse SELECT statements only. For the rest of statements, it switches to the Sleep Mode. You may deny switching to this mode by setting the QueryBuilder.AllowSleepMode to false. Also, you can set the SleepModeChangedevent handler to take additional actions.