Hi,
I have a parent details form with a child DataGridView, both bound to a typed dataset. When I want to add a new parent record, I have code that manually inserts child rows into the DataGridView based on certain criteria when the details form is first opened. My problem is that the parent record's ID column (ClassListID) isn't known until the form is closed and data is saved, so I don't know what to assign to child records' foreign keys (ClassListID) to. Obviously I want to assign all the child records to the ID value of the parent record. I tried using the SCOPE_IDENTITY command in a SQL query without any luck. Thanks for the help.
I have a parent details form with a child DataGridView, both bound to a typed dataset. When I want to add a new parent record, I have code that manually inserts child rows into the DataGridView based on certain criteria when the details form is first opened. My problem is that the parent record's ID column (ClassListID) isn't known until the form is closed and data is saved, so I don't know what to assign to child records' foreign keys (ClassListID) to. Obviously I want to assign all the child records to the ID value of the parent record. I tried using the SCOPE_IDENTITY command in a SQL query without any luck. Thanks for the help.
Comment