Question Status

Prasad Mohandas asked a question on 9 Apr 2010 2:33 AM

Can any one tell us how to call sql stored procedure using X++ CLASS

Martin Dráb responded on 9 Apr 2010 7:39 AM

Hi, use the Statement class for it (the following code must be run on server):

Connection connection = new Connection();
Statement statement = connection.createStatement();
str sqlCode = 'EXECUTE something - or any other SQL code';
SqlStatementExecutePermission permission = new SqlStatementExecutePermission(sqlCode);

Steve Jung responded on 4 Oct 2012 8:53 AM

How can the results of a class like this be used as a datasource for a form of report?

Steve Jung responded on 4 Oct 2012 9:08 AM

How can a class that uses the statement class be used as the data source for a form or report in the AOT?

Martin Dráb responded on 5 Oct 2012 4:43 AM

You can't use classes as a form (or MorphX report) datasource - it has to be a table. The solution is simply to fill a (temporary) table by the data - then just use it as usual.