c# relate parent and child table in datagridview

Question Description

I’m trying to study for my Programming course and I need some help to understand this question.

My Question is i have stock item table {item no, item name } and purchase child table include { item no}, i want to have datagridview have item no from purchase child and when select item it show the item name directly. have a relation between parent and child.

i used this code but i am not convinced ;

     private string selectQueryStringPurChild = "SELECT dbo.acc_PurChild.iRecnoPur, dbo.acc_PurChild.iPurchaseID, dbo.acc_PurChild.iStockID, " +
"dbo.acc_Stkitem.cFullname, dbo.acc_PurChild.nQty, dbo.acc_PurChild.nDisc, dbo.acc_PurChild.nCost, " +
"dbo.acc_PurChild.nTotal, dbo.acc_PurChild.nVat, dbo.acc_PurChild.nLine " +
"FROM         dbo.acc_PurChild INNER JOIN " +
"dbo.acc_Stkitem ON dbo.acc_PurChild.iStockID = dbo.acc_Stkitem.iStockID";

       private void dgvacc_PurChild_CellLeave(object sender, DataGridViewCellEventArgs e)
            int ncolumn = dgvacc_PurChild.CurrentCell.ColumnIndex;
            switch (ncolumn)
                case 1:

        private void GetStockItemFullName()
            dgvacc_PurChild.CurrentRow.Cells[2].Value = "2222";

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

Thank you for the opportunity to help you with your question!

In most cases, the discipline is self-governed by the entities which require the programming, and sometimes very strict environments are defined

Please let me know if you need any clarification. I'm always happy to answer your questions.

fitting k (56)
Duke University

Top quality work from this tutor! I’ll be back!

It’s my second time using SP and the work has been great back to back :) The one and only resource on the Interwebs for the work that needs to be done!

Thanks, good work


Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors