web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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

I have the same question (0)
  • Berthil Profile Picture
    204 on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 4 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans