Quantcast
Viewing all articles
Browse latest Browse all 72043

Executing Stored Procedures in Dynamics AX 2009

I created a method in a class (I set the property to run on server) and called this method from a job.  This method tries to execute a stored procedure (this SP inserts a dummy record in a table).  The process runs without any error but I cannot see the results!

If I run this SP from SQL Management Studio it works perfectly

 

    Connection con = new Connection();
    Statement stmt = con.createStatement();
    ResultSet r;
    str sql;
    SqlStatementExecutePermission perm;
    ;

    sql = strfmt('EXEC [insertdaxjob]');


    // Set code access permission to help protect the use of
    // Statement.executeUpdate.
    perm = new SqlStatementExecutePermission(sql);
    perm.assert();

    try
    {
        stmt.executeUpdate(sql);
    }
    catch (exception::Error)
    {
        print "An error occured in the query.";
        pause;
    }
    // Code access permission scope ends here.
    CodeAccessPermission::revertAssert();

 

Can anyone help?


Viewing all articles
Browse latest Browse all 72043

Trending Articles