Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Microsoft Dynamics AX 4.0 and Stored Procedures

1 view
Skip to first unread message

At Nai@discussions.microsoft.com Eduardo At Nai

unread,
Jul 21, 2008, 5:13:01 PM7/21/08
to
Greetings!

I have a question regarding Microsoft Dynamics AX 4.0. We recently have new
challenges at the work place and I would like to know if there is any way to
create and run my own Stored Procedures in Microsoft Dynamics. Or if there is
any way to mimic this action.

We run SQL Server Enterprise Edition and we also run Visual Studio 2005 if
we need to use it.

Thank you so much!

Eduardo

Mohammed Rasheed

unread,
Jul 21, 2008, 8:01:00 PM7/21/08
to
Hi Eduardo,

that's certainly is possible..

on of the way of doing it would be via the connection/statement/resultset
classes.. consider the following example (i am assuming that you are trying
to execute the sp on the same server as you ax db?):

Connection Connection;
Statement Statement;
ResultSet ResultSet;
SqlStatementExecutePermission perm;
str sqlStatement = "exec usp_doSomething"; // u can also use create here
;
Connection= new Connection();
Statement= Connection.createStatement();
perm = new SqlStatementExecutePermission(sqlStatement );
perm.assert();
ResultSet= Stmt.executeQuery(sqlStatement );

while ( ResultSet.next() )
{
info(strfmt("my SP result = %1", ResultSet.getString(1)));
}

hope this helps. let us know if you have any more questions.

regards,

Mohammed Rasheed
www.dynamic-ax.co.uk
--
www.dynamic-ax.co.uk

Francisco Tejada

unread,
May 7, 2009, 12:56:04 PM5/7/09
to
Hi:
Please what would be the code if the DataBase isn't in the same server of
the Application, the parser throw the following error:

Message (11:51:01)
Error 'SqlStatementExecutePermission'.
(S)\Classes\SqlStatementExecutePermission\demand
(S)\Classes\Statement\executeQuery
(C)\Reports\Report20\Methods\init - line 42


Hope you can help me.
Best Regards!
--
Juan Francisco T.

KMChong

unread,
May 27, 2009, 6:20:02 AM5/27/09
to
Hi Francisco Tejada,

In order for you to call the database on other server, you can use the
LoginProperty and ODBCConnection.

LoginProperty loginProperty;
ODBCConnection odbcConnection;
....

loginProperty = new LoginProperty();
loginProperty.setDatabase("abc");
loginProperty.setDSN("yourdns");
loginProperty.setUsername("sa");
loginProperty.setPassword("");
odbcConnection = new ODBCConnection(loginProperty);
statement = odbcConnection.createStatement();
...

Hope this piece of code can allow you to call the database server that sit
on other server.

Regards,
KMChong

0 new messages