{"id":1913,"date":"2007-07-06T06:57:00","date_gmt":"2007-07-06T06:57:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/cesardelatorre\/2007\/07\/06\/using-dynamics-ax-net-business-connector-to-access-dynamics-ax-4-0-from-net-world\/"},"modified":"2007-07-06T06:57:00","modified_gmt":"2007-07-06T06:57:00","slug":"using-dynamics-ax-net-business-connector-to-access-dynamics-ax-4-0-from-net-world","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/using-dynamics-ax-net-business-connector-to-access-dynamics-ax-4-0-from-net-world\/","title":{"rendered":"Using Dynamics &#8216;AX .NET Business Connector&#8217; to access Dynamics AX 4.0 from .NET world"},"content":{"rendered":"<p><SPAN lang=\"EN-US\">\n<P><SPAN lang=\"EN-US\">So, this is a really interesting integration aspect between AX and .NET apps. We want to access AX business logic (or data, transactions, etc.) from the .NET world. \ud83d\ude42<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\"><STRONG>Requirements<\/STRONG><\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">Before starting to develop anything, we need to install several required components:<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">In my case, I\u2019ve got a single development machine where I have installed everything. I mean:<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\"><SPAN>&#8211;<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN lang=\"EN-US\">SQL Server 2005<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\"><SPAN>&#8211;<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN lang=\"EN-US\">Dynamics AX 4.0<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\"><SPAN>&#8211;<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN lang=\"EN-US\">AX .NET Business Connector<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\"><SPAN>&#8211;<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN lang=\"EN-US\">Visual Studio 2005 (for .NET development)<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\"><SPAN>&#8211;<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><SPAN lang=\"EN-US\">We could also install \u2018<EM>Windows SharePoint Services<\/EM>\u2019 and the \u2018AX Enterprise Portal\u2019. It also uses .NET Business Connector for accessing AX, but in this case, we are just<SPAN>&nbsp; <\/SPAN>talking about .NET and AX. I\u2019ll maybe post about \u2018AX Enterprise Portal\u2019 and Windows SharePoint Services in another posting. <\/SPAN><SPAN lang=\"EN-US\"><SPAN>J<\/SPAN><\/SPAN><SPAN lang=\"EN-US\"><\/SPAN><\/P>\n<P><STRONG><SPAN lang=\"EN-US\">So!, the <\/SPAN><\/STRONG><STRONG><SPAN lang=\"EN-US\">AX .NET Business Connector<\/SPAN><\/STRONG><SPAN lang=\"EN-US\"> allows accessing Microsoft <STRONG><SPAN>Dynamics AX<\/SPAN><\/STRONG> from our own .NET applications as though they were a native Microsoft Dynamics AX client. So any .NET app or even ASP.NET web-app could access AX business components using this connector. For instance, as I already said, the \u2018AX Enterprise Portal\u2019 (based on Windows SharePoint Services and .NET) uses .NET Business Connector to access AX business logic.<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">BTW, internally, all these integration technologies interact with Dynamics AX through <B><I>Application Object Server<\/I><\/B> (<B>AOS<\/B>), which is kind of the \u2018<I>Business Components Application Tier<\/I>\u2019 within AX architecture itself.<\/SPAN><\/P>\n<P><STRONG><SPAN lang=\"EN-US\">AX .NET Business Connector installation and configuration<\/SPAN><\/STRONG><SPAN lang=\"EN-US\"><\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">Before installing Business Connector, the following must be available in the domain: <\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">&#8211; A core Microsoft Dynamics AX installation. This installation can be completed at the same time as the Business Connector installation, or it can be done prior to this installation. <\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">&#8211; Active Directory configured in native mode.<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">By default, it uses Windows authentication security (AD), so it can be also integrated with AX Enterprise Portal (based on Windows SharePoint Services, which also uses Windows security). This security authentication type is important to have it into account when accessing from our own .NET apps.<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">We also need a Windows domain account to act as the Business Connector Proxy. So we need to configure the Business Connector if our application requires &#8220;act-on-behalf-of&#8221; functionality for external users or users that are at times unable to connect to our application.<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">So, for instance, I created an account within <B><I>Windows Active Directory<\/I><\/B>, called <B>MyDomain\\bcproxy<\/B>. That account is going to be my \u2018proxy account\u2019.<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">Remember to assign a password to the user, select the Password does not expire option and select the No interactive logon rights option.<\/SPAN><\/P>\n<P><B><SPAN lang=\"EN-US\">(Optional) Adding the proxy account to the IIS local Windows group<\/SPAN><\/B><SPAN lang=\"EN-US\">.<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">For Web applications, we must add the Business Connector proxy account to the IIS local Windows group. If you are using Windows SharePoint Services, you must also add the account to the Windows SharePoint local Windows group.<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">1. Open the Computer Management application (Start &gt; Administrative Tools &gt; Computer Management).<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">2. Expand the Groups folder under Local Users and Groups.<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">3. Add the Business Connector proxy account to the following groups:<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>&#8211; IIS_WPG (IIS Worker Process Group)<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>&#8211; STS_WPG (STS Worker Process Group), if running Windows SharePoint Services<\/SPAN><\/P>\n<P><B><SPAN lang=\"EN-US\">(Optional) Configure the IIS application pool<\/SPAN><\/B><\/P>\n<P><SPAN lang=\"EN-US\">For Web applications, you must associate the Business Connector proxy account to the appropriate application pool identity.<\/SPAN><\/P>\n<P><B><SPAN lang=\"EN-US\">Installation of<SPAN>&nbsp; <\/SPAN>\u2018.NET Business Connector\u2019 setup-app.<\/SPAN><\/B><\/P>\n<P><SPAN lang=\"EN-US\">So now we are ready to install \u2018.NET Business Connector\u2019 from normal AX setup.exe DVD, but we have to select that we want to install it. \ud83d\ude09<\/SPAN><\/P>\n<P><SPAN lang=\"EN-US\">The setup\u2019s steps and quite normal, almost just the \u2018next, next\u2019 stuff. <\/SPAN><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Configure the Business Connector Proxy User<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">The last step is to configure the Business Connector Proxy User within AX configuration:<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">1. Start Microsoft Dynamics AX (Start &gt; All Programs &gt; Microsoft Dynamics &gt; Microsoft Dynamics AX 4.0 Client).<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">2. Open the Business Connector Proxy dialog box: Administration &gt; Setup &gt; Security &gt; Business Connector Proxy.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">3. In the Alias box, enter the alias. In the Network domain box, enter the domain of the user and then close the dialog box.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Implementing a sample AX class to consume it<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">So now we\u2019re starting one of the fun tasks!!<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">We are going to implement a basic <B>X++ class<\/B> with a simple method. Just for testing.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">So, within <B>Dynamics AX client<\/B>, open the <B>AOT<\/B> (<B><I>Application Objects Tree<\/I><\/B>):<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><IMG height=\"332\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/Jul%2006%202007%20-%2001%20-%20AOT.jpg\" width=\"269\"><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Then, let\u2019s create a new simple class, like the following:<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><SPAN lang=\"EN-US\"><IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/Jul%2006%202007%20-%2002%20-%20XplusplusClass.jpg\"><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">So, I\u2019ve created a very simple method called \u2018Salute()\u2019, which accepts a single string parameter (a name) and then it responds with a salutation. It is very simple, just a testing method for accessing AX from .NET world. <\/FONT><\/SPAN><SPAN lang=\"EN-US\"><SPAN>J<\/SPAN><\/SPAN><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">. Here is the Salute() method code:<\/FONT><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><IMG height=\"252\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/Jul%2006%202007%20-%2003%20-%20XplusplusCode.jpg\" width=\"425\"><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><STRONG>X++ Code: <\/STRONG><\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><STRONG>client server public static str Salute(str name)<BR>{<BR>&nbsp;&nbsp; str salute = &#8220;Cheers &#8221; + name + &#8220;! from AX!&#8221;;<BR>&nbsp;&nbsp; ;<BR>&nbsp;&nbsp; return salute;<BR>}<\/STRONG><\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Great!, very simple!. An if you are used to C# or C++, <B>X++<\/B> it is quite similar!.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">So now, we could test this method calling it from an AX JOB. But, we\u2019re directly to execute it calling it from .NET (developing with Visual Studio 2005) through the <B><I>\u2018AX .NET Business Connector\u2019<\/I><\/B>. <\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Ok, I\u2019ve created a simple <I>WinForms<\/I> application project called NetBcWinFormsTest. Take into account that this is just for testing. If it were a real application (.NET <I>WinForms <\/I>client as presentation layer), may be we\u2019ll use a Web-Service or WCF-Service in between (for remote calls).<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">So, here we can see VS.2005 with our simple WinForms proyect, and a single Windows form with a button:<\/FONT><\/FONT><\/SPAN><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">&nbsp;<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><IMG height=\"272\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/Jul%2006%202007%20-%2004%20-%20VS2005App.jpg\" width=\"425\"><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">So now, we have to add a reference to the <B><I>\u2018AX .NET Business Connector\u2019 <\/I><\/B>.NET assembly, which is the \u2018<B>Microsoft.Dynamics.BusinessConnectorNet.dll<\/B>\u2019.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">We have to add it using the \u2018Add Reference<\/FONT><\/SPAN><SPAN lang=\"EN-US\"><SPAN>\u00e0<\/SPAN><\/SPAN><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">Browse\u2019 option, selecting the physical .dll situated on: <\/FONT><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\"><STRONG>C:\\Program Files\\Microsoft Dynamics AX\\40\\Client\\Bin\\Microsoft.Dynamics.BusinessConnectorNet.dll<\/STRONG><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><IMG src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/Jul%2006%202007%20-%2005%20-%20BCNReferences.jpg\">&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Ok, now we are ready for programming some C# code (or VB.Net code, of course).<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Let\u2019s double click on our simple button, and add the following code:<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">A \u2018using\u2019 sentence (just like a shortcut for our C# code):<\/FONT><\/FONT><\/SPAN><\/P>\n<P>\n<TABLE class=\"MsoTableGrid\" cellSpacing=\"0\" cellPadding=\"0\" border=\"1\">\n<TBODY>\n<TR>\n<TD class=\"\" vAlign=\"top\" width=\"576\">\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">using System;<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">using System.Collections.Generic;<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">using System.ComponentModel;<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">using System.Data;<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">using System.Drawing;<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">using System.Text;<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">using System.Windows.Forms;<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Calibri\" size=\"3\"><\/FONT><SPAN lang=\"EN-US\"><FONT face=\"Calibri\" size=\"3\">&nbsp;<\/FONT><\/SPAN><\/P><BR>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">using Bcn = Microsoft.Dynamics.BusinessConnectorNet;<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\" size=\"3\">&nbsp;<\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">namespace NetBcWinFormsTest<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">{<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN>public partial class Form1 : Form<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Calibri\" size=\"3\"><\/FONT><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN>{<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>public Form1()<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>InitializeComponent();<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>}<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\" size=\"3\">&nbsp;<\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>private void btnAccessAX_Click(object sender, EventArgs e)<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><B>\/\/ Create a BCN object<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/B><\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>Bcn.Axapta axp;<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>axp = new Bcn.Axapta();<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>try<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>\/\/ In this case there\u2019s no need for credentials, it is taken from Winforms execution<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>&nbsp;<\/SPAN>\/\/ because this is just a sample testing application.<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>\/\/ but if it were an ASP.NET app, we should provide specific credentials.<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>axp.Logon(null, null, null, null);<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>}<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>catch (Exception excepn)<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>MessageBox.Show(excepn.ToString());<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>return;<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>}<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>\/\/Calling the X++ static Method!!.<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>string salutation;<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>salutation = (string)axp.CallStaticClassMethod(<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>&#8220;CdltllDemoBcnClass&#8221;,<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>\/\/ The class name.<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>&#8220;Salute&#8221;,<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>&nbsp;<\/SPAN>\/\/ method&#8217;s name.<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>&#8220;CESAR&#8221;);<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>\/\/ Parameters.<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>MessageBox.Show(salutation);<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT face=\"Calibri\" size=\"3\">&nbsp;<\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><B><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>axp.Logoff();<\/FONT><\/FONT><\/SPAN><\/B><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><FONT face=\"Calibri\"><B><SPAN lang=\"EN-US\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>\/\/<\/SPAN><\/B><SPAN lang=\"EN-US\"><\/SPAN><\/FONT><\/FONT><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>}<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN>}<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">}<\/FONT><\/FONT><\/SPAN><\/P><\/TD><\/TR><\/TBODY><\/TABLE><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\" size=\"3\"><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Take a look to the selected code and read all the C# comments within that code.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">Note that we are instancing a standard BCN object using the class (<B>Microsoft.Dynamics.BusinessConnectorNet.Axapta<\/B>), and then, when calling the \u2018<B>CallStaticClassMethod()<\/B>\u2019<SPAN>&nbsp; <\/SPAN>method, <SPAN>&nbsp;<\/SPAN>we have to provide all the X++ class and method <SPAN>&nbsp;<\/SPAN>information.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">So!, the resulting execution in our .NET App is the following\u2026:<\/FONT><\/FONT><\/SPAN><FONT size=\"3\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">&nbsp;<\/FONT><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><SPAN lang=\"EN-US\"><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">&nbsp;<IMG height=\"229\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/Jul%2006%202007%20-%2006%20-%20NetWinAppExecution.jpg\" width=\"317\"><\/FONT><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">Not a very impressive graphics interface, but we are getting that result from within Dynamics AX business logic!! <\/FONT><\/SPAN><SPAN lang=\"EN-US\"><SPAN>J<\/SPAN><\/SPAN><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">.<\/FONT><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\">Next step is getting real data from AX tables and AX business classes.<\/FONT><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Calibri\" size=\"3\"><SPAN lang=\"EN-US\"><STRONG>Getting AX real Data (Updated &#8211; November 28th 2007)<\/STRONG><\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Calibri\" size=\"3\"><SPAN lang=\"EN-US\">So, now, we&#8217;re going to add a new functionality to our little .NET program. In this case, we are going to invoke AX classes to get real AX data. For instance, we&#8217;re going to get data about Vendors.<\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Calibri\" size=\"3\"><SPAN lang=\"EN-US\">Then, we add another simple <EM>button<\/EM> to our .NET form, and also a <EM>DataGridView<\/EM> where we&#8217;ll show that data. It would look like the following:<\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/image_4.png\"><IMG height=\"285\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/image_thumb_1.png\" width=\"344\" border=\"0\"><\/A> <\/P>\n<P class=\"MsoNormal\"><FONT face=\"Calibri\" size=\"3\"><SPAN lang=\"EN-US\">Then, we add the following code to be triggered from our second button:<\/SPAN><\/FONT><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\">A \u2018using\u2019 sentence (just like a shortcut for our C# code):<\/FONT><\/FONT><\/SPAN><\/P>\n<P>\n<TABLE class=\"MsoTableGrid\" cellSpacing=\"0\" cellPadding=\"0\" border=\"1\">\n<TBODY>\n<TR>\n<TD class=\"\" vAlign=\"top\" width=\"576\">\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT size=\"3\"><FONT face=\"Calibri\"><\/FONT><\/FONT><\/SPAN>&nbsp;<\/P>\n<P>private void btnAxDataAccess_Click(object sender, EventArgs e) \n<P>{ \n<BLOCKQUOTE>\n<P><B>\/\/ .NET Business Connector objects<\/B> \n<P><B>Bcn.Axapta ax;<\/B> \n<P><B>Bcn.AxaptaRecord axRecord;<\/B> \n<P><B>\/\/ Name of table to query.<\/B> \n<P>String strTable = &#8220;VendTable&#8221;; \n<P><B>\/\/ VendTable field names for calls to AxRecord.get_field<\/B> \n<P>String strVendAccountNumField = &#8220;AccountNum&#8221;; \n<P>String strVendNameField = &#8220;Name&#8221;; \n<P><B>\/\/ Output variables for calls to AxRecord.get_Field<\/B> \n<P>Object vendAccNum, vendName; \n<P><B>\/\/ String used to query table.<\/B> \n<P>String strQuery = &#8220;select * from %1&#8221;; \n<P>\/\/Sample including WHERE clause \n<P>\/\/strQuery = &#8220;select * from %1 where %1.vendGroup == &#8216; my_search_criteria_here &#8216;&#8221;; \n<P>try \n<P>{ \n<P><B>\/\/ Log on to Microsoft Dynamics AX.<\/B> \n<P><B>ax = new Bcn.Axapta();<\/B> \n<P><B>ax.Logon(null, null, null, null);<\/B> \n<P><B><\/B>\n<P><B>\/\/ Create an AxaptaRecord object for the VendTable.<\/B> \n<P><B>axRecord = ax.CreateAxaptaRecord(strTable);<\/B> \n<P><B><\/B>\n<P><B>\/\/ Execute the query on the table.<\/B> \n<P><B>axRecord.ExecuteStmt(strQuery);<\/B> \n<P><B>\/\/ DataTable creation<\/B> \n<P>DataTable dt = CreateVendorDataTable(); \n<P>DataRow row; \n<P><B>\/\/ Loop through the set of retrieved records.<\/B> \n<P><B>while (axRecord.Found)<\/B> \n<P><B>{<\/B> \n<P><B>\/\/ Retrieve the record data for the<\/B> \n<P><B>\/\/ specified fields.<\/B> \n<P><B>vendName = axRecord.get_Field(strVendNameField);<\/B> \n<P><B>vendAccNum = axRecord.get_Field(strVendAccountNumField);<\/B> \n<P><B><\/B>\n<P><B>row = dt.NewRow();<\/B> \n<P><B>row[&#8220;Name&#8221;] = vendName.ToString();<\/B> \n<P><B>row[&#8220;AccNum&#8221;] = vendAccNum.ToString();<\/B> \n<P><B>dt.Rows.Add(row);<\/B> \n<P><B>\/\/ Advance to the next row.<\/B> \n<P><B>axRecord.Next();<\/B><\/P><\/BLOCKQUOTE>\n<BLOCKQUOTE>\n<P><B>}<\/B> \n<P><B>\/\/ Dispose of the AxaptaRecord object.<\/B> \n<P>axRecord.Dispose(); \n<P><B>\/\/ Log off from Microsoft Dynamics AX.<\/B> \n<P>ax.Logoff(); \n<P><B>\/\/Data-Binding with our GRID<\/B> \n<P>dataGridView1.DataSource = dt; \n<P>} \n<P>catch (Exception ex) \n<P>{ \n<P>\/\/ Console.WriteLine(&#8220;Error encountered: {0}&#8221;, e.Message); \n<P>\/\/ Take other error action as needed. \n<P>}<\/P><\/BLOCKQUOTE>\n<P>} \n<P><B>\/\/ Create an ADO.NET DataTable \u2018on the fly\u2019<\/B> \n<P>public DataTable CreateVendorDataTable() \n<P>{ \n<BLOCKQUOTE>\n<P>DataTable dt = new DataTable(); \n<P>dt = new DataTable(); \n<P>DataColumn vendorNameColumn; \n<P>vendorNameColumn = new DataColumn(&#8220;Name&#8221;); \n<P>vendorNameColumn.DataType = Type.GetType(&#8220;System.String&#8221;); \n<P>dt.Columns.Add(vendorNameColumn); \n<P>DataColumn vendorAccNumColumn; \n<P>vendorAccNumColumn = new DataColumn(&#8220;AccNum&#8221;); \n<P>vendorAccNumColumn.DataType = Type.GetType(&#8220;System.String&#8221;); \n<P>dt.Columns.Add(vendorAccNumColumn); \n<P>return dt;<\/P><\/BLOCKQUOTE>\n<P>}<\/P><\/TD><\/TR><\/TBODY><\/TABLE><\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\" size=\"3\"><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Calibri\" size=\"3\">So, what we are doing is using the <\/FONT><STRONG>AxaptaRecord<\/STRONG> class to select and get all the records from AX data. Keep in mind one important thing. Unlike ADO.NET, which is connectionless oriented, AX data access classes are connection-oriented. I mean, once you have selected what you want, you have to loop over it in a connected environment. In this case, what I am doing is looping through all the records and creating an <STRONG>ADO.NET DataTable<\/STRONG> &#8216;<EM>on the fly<\/EM>&#8216; (could be within a <STRONG>DataSet<\/STRONG>). After having a <STRONG>DataTable<\/STRONG> or <STRONG>DataSet<\/STRONG> we could return it to any other .NET assembly or, as in this case, we just make a <STRONG><EM>DataBinding<\/EM><\/STRONG> with our <STRONG>GridView<\/STRONG>, so we show all the records.<\/P>\n<P class=\"MsoNormal\">Or course, in a real Application and depending of data volume, we should filter data based on kind of &#8216;data pages&#8217; or &#8216;data windows&#8217;, so we won&#8217;t fill a single DataTable with all the AX table data. <\/P>\n<P class=\"MsoNormal\">So, if we execute it, we&#8217;ll get all that AX data!. <\/P>\n<P class=\"MsoNormal\"><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/image_6.png\"><IMG height=\"391\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/image_thumb_2.png\" width=\"473\" border=\"0\"><\/A> <\/P>\n<P class=\"MsoNormal\">Magic between .NET and Dynamics AX?. \ud83d\ude42<\/P>\n<P class=\"MsoNormal\"><FONT face=\"Calibri\" size=\"3\"><SPAN lang=\"EN-US\"><\/SPAN><\/FONT>&nbsp;<\/P>\n<P class=\"MsoNormal\"><SPAN lang=\"EN-US\"><FONT face=\"Calibri\" size=\"3\">&nbsp;<\/FONT><\/SPAN><\/SPAN><\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, this is a really interesting integration aspect between AX and .NET apps. We want to access AX business logic (or data, transactions, etc.) from the .NET world. \ud83d\ude42 Requirements Before starting to develop anything, we need to install several required components: In my case, I\u2019ve got a single development machine where I have installed [&hellip;]<\/p>\n","protected":false},"author":362,"featured_media":12806,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1913","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cesardelatorre"],"acf":[],"blog_post_summary":"<p>So, this is a really interesting integration aspect between AX and .NET apps. We want to access AX business logic (or data, transactions, etc.) from the .NET world. \ud83d\ude42 Requirements Before starting to develop anything, we need to install several required components: In my case, I\u2019ve got a single development machine where I have installed [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/1913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/comments?post=1913"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/1913\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media\/12806"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media?parent=1913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/categories?post=1913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/tags?post=1913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}