
Hello,
I am trying to execute SP from AX 2009 using OdbcConnection. But the SP will not execute till the end. The SP will open a Cursor and work on 80K lines when executing from SQL server directly. But only 100+ lines will execute when running from AX 2009. What could be reason for this to happen? Code is following:
LoginProperty loginProperty;
OdbcConnection odbcConnection;
Statement statement;
SqlStatementExecutePermission perm;
str StrFromdate,StTodate;
str SqlStmt;
;
loginProperty = new LoginProperty();
loginProperty.setDSN("AA");
odbcConnection = new OdbcConnection(loginProperty);
statement = odbcConnection.createStatement();
//info(strfmt("%1",beginDate.dateYear()));
StrFromdate = strFmt('%1-%2-%3',
year(beginDate.dateValue()),mthOfYr(beginDate.dateValue()),
dayOfMth(beginDate.dateValue()));
StTodate = strFmt('%1-%2-%3',
year(endDate.dateValue()),mthOfYr(endDate.dateValue()),
dayOfMth(endDate.dateValue()) );
SqlStmt =strFmt('Exec TestDB.dbo.MYSP \'%1\',\'%2\'',StrFromdate,StTodate) ;
//info(sqlstmt);
new SqlStatementExecutePermission(SqlStmt).assert();
statement.executeUpdate(SqlStmt);
CodeAccessPermission::revertAssert();
Thanks all for your responses.
*This post is locked for comments
I have the same question (0)Could there be a timeout on your ODBC-connection that your Stored Procedure times out?
Check this article and search for timeout: docs.microsoft.com/.../ms811006(v=msdn.10)
yours,
Berthil