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 :
Finance | Project Operations, Human Resources, ...
Answered

Inserting Records in two tables at same time

(0) ShareShare
ReportReport
Posted on by 456

Hi, 

Im having two tables named Student Information , Student Marks . The Student Information table has two fields , Student Name and Rollno , the Student Marks table contains two fields Rollno and marks . If im Entering Roll no in Student information table the same roll no should be inserted in Student marks table . and also if im modifying the roll no in student infomation table it also updated in student marks table . i need x++ code for that . i am new to AX. 

Thanks in Advance . 

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    239,082 Most Valuable Professional on at

    It looks like the same topic as what's already discussed in your other thread Inserting Data into Two Tables at same time by using Code.

  • Suggested answer
    abdullah0094@hotmail.com Profile Picture
    85 on at

    Please check similar job

    Student Information -> student Name, RollNo -> StudentInformation

    Student Marks -> Roll no, marks -> StudentMarks

    public static void main(Args _args)

    {

    StudentInformation  student;

    StudentMarks    marks;

    ;

    ttsbegin;

    //Insertion of new record

    student.clear();

    student.rollNo = '1';

    student.name = "Check";

    student.insert();

    select marks where

    marks.rollNo == student.rollNo;

    if(!marks)

    {

    marks.rollNo = '1';

    marks.marks = '91';

    marks.insert();

    }

    ttscommit;

    //for updation

    select forupdate student

    where student.rollNo == '1';

    student.rollNo = 20;

    student.update();

    update_recordset marks

        setting roll = '20'

    where roll = '1';

    info("done");

    }

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 653

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 493 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 317 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans