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)

How to pass datatable .net to AX??

(0) ShareShare
ReportReport
Posted on by

Hi all,


Can anyone help me?
I have a  web service( WCF) that returns datatable. I call service from AX. I want to save the datatable of the service at AX.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    Do I understand correctly that you successfully receive the a DataTable object but you don't know how to read data from it, or maybe how to create a table record inside AX?

    If you explain your problem in detail, it'll become easier for others to help you.

  • Vilmos Kintera Profile Picture
    46,149 on at

    If you are able to call the web service and cast the return value into a System.Data.DataTable object, then all you need to do is to read out the data from it. Which part are you having difficulty with? Here is the documentation with examples and properties/methods of the DataTable object:

    msdn.microsoft.com/.../system.data.datatable(v=vs.110).aspx

  • Community Member Profile Picture
    on at

    Web service:

    public DataTable Test()

    {

     DataTable dt = new DataTable();

     dt.Columns.Add("Code",typeof(string));

     dt.Columns.Add("Name",typeof(string));

     dt.Rows.Add( new object[]{ "123","abc"});

     dt.Rows.Add(new object[]{"123","cde"});

     return dt;

    }

    I want to read datatable (webservice) in ax 2012.

  • Community Member Profile Picture
    on at

    thanks for your reply.

  • Community Member Profile Picture
    on at

    hi Martin,

    thanks for your reply.

  • Vilmos Kintera Profile Picture
    46,149 on at

    Ok, we understood this part that you have a web service that returns a DataTable, but what are you having trouble with in your AX code?

  • Community Member Profile Picture
    on at

    hi Vilmos Kintera,

    I want to read the table by x ++ but I do not know how to do it

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    [View:https://technet.microsoft.com/en-us/library/hh500185.aspx:750:50]

    [View:http://yetanotherdynamicsaxblog.blogspot.hu/2013/10/consuming-web-service-in-ax-2012-is-easy.html:750:50]

    Now you have all the details required to know. How to call external services from AX code, and what namespace can be used for accessing DataTable information.

    Combine all of the above, it should not be a problem for any developers, since you have a lot of examples already.

    Please make sure you mark helpful answers next to each post.

  • Community Member Profile Picture
    on at

    hi Vilmos Kintera ,

    For example, you send data list. You can navigate based on the code I send

  • Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    I still don't see any explanation of what problem you have when you try to get the value returned by Test(). Did you try it at all? If so, what problem did run into? Or does it mean that you don't know how to consume web service in general? In that case, read Consuming Web Services.

    The only piece of code you gave is the web service, although your problem is somewhere else.

    By not explaining what you need, you make it very difficult for others to help you, which is clearly not in your best interest.

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