Sometimes it happens that you receive an error message if you have tried to execute a native SQL statement.

The reason for this is that the request for the permission of type 'SqlStatementExecutePermission' failed.

(S)\Classes\SqlStatementExecutePermission\demand
(S)\Classes\Statement\executeQuery
(C)\Jobs\Job1 - line 25

The connection class can be used only in code running on server and therefore this behavior is shown.

You can solve this issue easily, if you use the method marked as server static and call this method from the display method.