web
You’re offline. This is a read only version of the page.
close
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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans