new Child/parent parent record in typed dataset.
I've followed the wizard to create a dataset. This datset has two tables, one
master, and one child. I've also had the wizard create stored procedres for
select, insert, etc.
I am not binding the data. Instead I've taken a form and am inserting the
records manually (No selects, deletes, or updates). The code follows the
logic below.
A constraint violation is thrown when I add the master row. I believe that I
am not following the correct method to perform this update. Unfortunately,
Every book and search have gone to great detail to discuss alternate methods.
Where is my misunderstanding in how this process should be written?
Dim sc As New Scenario
Dim dr As DataRow = sc.ScenarioDetail.NewRow()
Dim mr As DataRow = sc.ScenarioMaster.NewRow()
..
..
<Update row mr>
<update row dr >
..
..
dr.SetParentRow(mr)
sc.ScenarioDetail.Adduwm_QLSS_ScenarioDetailRow(dr)
sc.ScenarioMaster.Adduwm_QLSS_ScenarioMasterRow(mr)
Dim ma As New ScenarioTableAdapters.ScenarioMasterTableAdapter
Dim da As New ScenarioTableAdapters.ScenarioDetailTableAdapter
Dim rw As Integer
rw = ma.Update(scenario) <=Constraint error thrown.
rw = da.Update(scenario)
Is this the scenaio where I have to create a handler to retrieve the @@SCOPE
and update the detail key manually? -Or-
Am I suppose to set something else up for this to happen "behind the scenes"?
while I wait for an answer. I'm going to rebuild the webform and try just
binding it to the form.
Date:Thu, 16 Aug 2007 18:23:37 -0700
Author:
|