Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Execute SP from AX 2009 in SQL server - Error

(0) ShareShare
ReportReport
Posted on by 52

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

  • Berthil Profile Picture
    Berthil 200 on at
    RE: Execute SP from AX 2009 in SQL server - Error

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans