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
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
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.
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