Thursday, April 10, 2008
"Inside Dynamics AX 4.0" as PDF
The book is now released by MS as PDF for download: http://download.microsoft.com/download/2/5/8/258C8894-B94A-4A87-81EA-4DBB9776F8F2/622579eBook.pdf
Wednesday, April 2, 2008
Read data from other databases
Here is a small exsample on how to do that from version 4.0 and greater:
Make sure the code is executed on the AOS, as only the AOS is allowed to access databases outside AX.
ODBCConnection connection;
SqlSystem sqlSystem = new SqlSystem();
LoginProperty loginProperty = sqlSystem.createLoginProperty();
Statement statement;
ResultSet resultSet;
SqlStatementExecutePermission sqlStatementExecutePermission;
str sqlStatement;
int columnId;
;
loginProperty = sqlSystem.createLoginProperty();
loginProperty.setServer('MyServer');
loginProperty.setDatabase('MyDatabase');
connection = new ODBCConnection(loginProperty);
statement = connection.createStatement();
sqlStatement = "select * from MyTable";
sqlStatementExecutePermission = new SqlStatementExecutePermission(sqlStatement);
sqlStatementExecutePermission.assert();
resultSet = statement.executeQuery(sqlStatement);
while (resultSet.next())
{
// Get data from colum 2
columnId = 2;
print resultSet.getString(columnId);
}
pause;
Make sure the code is executed on the AOS, as only the AOS is allowed to access databases outside AX.
Subscribe to:
Posts (Atom)