Microsoft Dynamics 365 Blog


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.

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!