|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
Axapta ax; AxaptaRecord record; try { // Create AX object and logon to AX ax = new Axapta(); ax.Logon(null, null, null, null); // Create a new AxaptaRecord object with // the name of the table as input parameter using (record = ax.CreateAxaptaRecord("CarTable")) { // Remember to clear the tablebuffer if // you are inserting inside a loop record.Clear(); record.InitValue(); // Set the fields in the table record.set_Field("CARID", "XXX1"); record.set_Field("MODELYEAR", 1998); record.set_Field("CARBRAND", "FORD"); record.set_Field("MODEL", "F1"); record.set_Field("MILEAGE", 89378); // Insert the record record.Insert(); } // End the AX session ax.Logoff(); } catch (Exception e) { Console.WriteLine(e.Message); } |