Derived dataset updates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a 5 way table join that returns values I need to update
solutionSpecId, solutionId, decisionSpecValueId, specHeading, specDescription, and spec

I'm updating the SolutionSpecs table and it has solutionSpecId as the primary key
solutionId, decisionSpecValueId, and spec are also fields in that table

I'm editing the spec field on screen

I want to add a new record if spec is defined and solutionSpecid is NUL
delete a record if spec is empty and solutionSpecId is NOT NUL
and udpate a record if spec is not empty and solutionSpecId is NOT NUL

Is there a prefered way to make this happen in ADO.NET or do I just need to do it programmatically using a second data adapter for SolutionSpecs and iterating through the dataset issuing the appropriate commands.
 
Hi Larry,

Theoretically speaking, you should modify dataset as you wish and then call
each adapter's Update method on various rows in correct order.
See
Updating the Database with a DataAdapter and the DataSet
..net help chapter and at the bottom there is
Ordering of Inserts, Updates, and Deletes topic
to give you an idea.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Larry Charlton said:
I have a 5 way table join that returns values I need to update.
solutionSpecId, solutionId, decisionSpecValueId, specHeading, specDescription, and spec.

I'm updating the SolutionSpecs table and it has solutionSpecId as the primary key.
solutionId, decisionSpecValueId, and spec are also fields in that table.

I'm editing the spec field on screen.

I want to add a new record if spec is defined and solutionSpecid is NULL
delete a record if spec is empty and solutionSpecId is NOT NULL
and udpate a record if spec is not empty and solutionSpecId is NOT NULL

Is there a prefered way to make this happen in ADO.NET or do I just need
to do it programmatically using a second data adapter for SolutionSpecs and
iterating through the dataset issuing the appropriate commands.
 
Back
Top