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)

Statement.executeUpdate Method Reutrns?

(0) ShareShare
ReportReport
Posted on by 22

I have used  executeUpdate method  in my code, to execute an update query, according to the its definition on msdn, it would return the no. of rows updated, but in practical, it only returns 0 (the otherwise case) and does not returns the no. of rows updated. Does it, or not returns the number of rows / records updated when an update statement is executed or there is something which I am missing. Please share your thoughts. 

Thanks in advance. 

*This post is locked for comments

I have the same question (0)
  • Israel Gonzalez Profile Picture
    746 on at

    Can you share the SQL string that you are passing?

  • Syed Sheheryar Profile Picture
    22 on at

    Let's just assume a simple and static SQL update statement.

  • Israel Gonzalez Profile Picture
    746 on at

    I'm not sure about your code, but maybe your server require permission. Are you adding SqlStatementExecutePermission?

    You can view an example in this blog: community.dynamics.com/.../executing-direct-sql-statements

  • Syed Sheheryar Profile Picture
    22 on at

    Yes I am using the assert method too.

  • Syed Sheheryar Profile Picture
    22 on at

    .

    .

    .

    flag  = 0;                      

    CodeAccessPermission::revertAssert();

    statement = odbcConnection.createStatement();

    Query = 'UPDATE my_table with (ROWLOCK) SET my_Flag = ' + flag +

    ' where  my_DATE = ' + strFmt("'%1'",paramDate) ;

    new SqlStatementExecutePermission(Query).assert();

    statement.executeUpdate(Query);

    resultSet.close();

    statement.close();

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 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans