Siti ,

There are few things which accually I noted down and managed to solve the
problem:

1) The responsible class should have the run on property on server.
2) The DB should have the execute permission. You may go to SQL and try to
run the stored procedure from there to check if it has all rights and
showing correct result.
3) Use code permission assert outside the method. PS. Class >
ReleaseUpdateDB > statementExeQuery and statementExeUpdate methods.
4) Use executeUpdate() on when update is needed otherwise use
executeQuery();
5) use @ operator at the begining of the exe statement if procedure is
returning any values. for ex sql = @"EXEC sp_sum 5,9 ";

Hope this will help you.



On Tue, Mar 17, 2009 at 9:01 AM, Siti Nurulhuda MOHD ARIFFIN <
siti_nurulh...@cim.cubicgrp.com> wrote:

>
> Dear Mr. Pankaj   ,
>
> I've search through the web to find a solution to call stored procedure
> through ax2009 and found your
> issue which is quite same to mine  ->
>
> http://www.mail-archive.com/axapta-knowledge-village@yahoogroups.com/msg18370.html
>
> I used below class to run the SP and actually have tried to set the RunOn
> property to Server,
> but i still get the same error message which is
>
> Cannot execute the required database operation.
> The SQL database has issued an error.
>
> public static server void PopulateCUB_CheckTransAvail()
> {
>    str                             sql;
>    Connection                      conn ;
>    Statement                       _statement;
>    SqlStatementExecutePermission   permission;
>    int                             retval;
>    ;
>
>
>    conn = new Connection();
>
>    _statement = conn.createStatement();
>    sql = "EXEC CUB_UP_INS_CHECKTRANSAVAIL";
>    permission = new SqlStatementExecutePermission(sql);
>    permission.assert();
>    ttsbegin;
>    _statement.executeUpdate(sql);
>    ttscommit;
>    CodeAccessPermission::revertAssert();
> }
>
>
> We use the same method on Ax 4.0 and it succeed to call and run the SP but
> not on the Ax2009.
>
> Maybe you can give some advise or tips, how I need to run the SP
> successfully on Ax2009 since this is very new to me.
> Your kindly help is highly appreciated. Thank you.
>
>
>
> Warm Regards,
> ::  Siti Mohd Ariffin      ::
>
>
> Notice
> The information in this message is confidential and may be legally
> privileged.  It is intended solely for the addressee.  Access to this
> message by anyone else is unauthorized.  If you are not the intended
> recipient,  any disclosure,  copying or distribution of the message,  or
> any action taken by you in reliance on it,  is prohibited and may be
> unlawful.  If you have received this message in error,  please delete it
> and contact the sender immediately.  Thank you.




-- 
Pankaj Kumar Gupta
--

Reply via email to