In AX2012 I want to build an ODBC database connection to SQL Server 2008R2. Therefor I build the 32 Bit System-DSN ‘SQL Server Native Client 10.0’ (C:\Windows\SysWOW64\odbcad32.exe).
If I start the following code as job or directly in a button of a form, the connection to the database is correct.
{
LoginProperty loginProperty;
OdbcConnection myConnection1;
Statement myStatement;
SqlStatementExecutePermission perm;
str _query;
ResultSet result;
str retVal;
;
#macrolib.ocMegaBoard
loginProperty = new LoginProperty();
loginProperty.setDSN( #OCDSN );
myConnection1 = new OdbcConnection( loginProperty );
info('OK');
}
If I start the same code as part of different procedure calls, the following error message is coming: ‘[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application‘
Please, can you help me?