Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 73760

not able to insert record in AX 2012 useing business connector

$
0
0

Hi All,

 

This is the scenario

I have created a table in AX 2012 which has 4 fields.

I want to insert delete and update using dll.

I have tried below .

1)      Created a class(AXinsert) which will insert the value into table

2)      Created a form in VS.net and added the reference of the dll created by the class AXinsert

3)      Created a form in AX and added the DLL as reference .

Below is the code I used in class

public static void insert(string str1,string str2,string str3,string str4)

        {

            Axapta ax = new Axapta();

            ax.Logon(null, null, null, null);

 

            try

            {

                ax.TTSBegin();

 

                AxaptaRecord header = ax.CreateAxaptaRecord("SampleTable");

                header.Clear();

                header.set_Field("Field1", str1.ToString());

                header.set_Field("Field2", str2.ToString());

                header.set_Field("Field3", str3.ToString());

                header.set_Field("Field4", str4.ToString());

                header.Insert();

                ax.TTSCommit();

                ax.Logoff();

            }

            catch (Exception ex)

            {

                ax.TTSAbort();

                ax.Logoff();

                Console.WriteLine(ex.Message);

            }

I am able to insert the value in form VS.net but I am not able to insert using AX 2012 using AX forms.

 

Any suggestion please help me

Kind Regards

Somanna

 


Viewing all articles
Browse latest Browse all 73760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>