J
Jonathan Stone
Anyone have experience with a similar scenario as the following? I have to
believe someone has done this.
I am trying to use a dataadapter.update method to create new records in one
datatable with records from another.
Quick background: Table1 has template records that need to be created in
Table2. I say template records only in context of the application this is
for, each record represents a project task for a particular customer that
will always be a needed task for projects dealing with that customer, thus,
template tasks.
Anyways, each record from the template Table1 has an identity column["mid"]
and a parent column["parentID"] which creates the hiearchical relationship
of these tasks (to understand which are subtasks of others through this
parent child relationship. The top level tasks' parentID is set to '0'. When
I fill my dataset with the appropriate records, I then loop thru them and
make a few slight adjustments to some of the other datacolumns to identify
them more to the current new project at hand. Now I want to do
dataadapter.update to put these records into the actual task Table2. Now
this works great, the new tasks are inserted and the identity columns are
obviously udpated to the Table2's latest autonumbers. The problem i have run
into is the parentID field. In the template Table1, they reference the
correct parent record, but once in the new Table2, the parentID column data
is still the static data that it was in the template Table1. I am trying to
find a way to keep this relation from Table1 into Table2 so that the new
records in Table2's parentIDs reference the new autonumber fields that keep
them tied to the appropriate parent tasks.
I've read much about creating DataRelations, Constraints but I just can't
get the formula correct, or maybe its not even the right way to do this.
I'm looking for any ideas or experiences that would lead me to the answer
here, the solution to this problem that has tied me up for a good 8 hours
now.
Thanks for any help
jon
believe someone has done this.
I am trying to use a dataadapter.update method to create new records in one
datatable with records from another.
Quick background: Table1 has template records that need to be created in
Table2. I say template records only in context of the application this is
for, each record represents a project task for a particular customer that
will always be a needed task for projects dealing with that customer, thus,
template tasks.
Anyways, each record from the template Table1 has an identity column["mid"]
and a parent column["parentID"] which creates the hiearchical relationship
of these tasks (to understand which are subtasks of others through this
parent child relationship. The top level tasks' parentID is set to '0'. When
I fill my dataset with the appropriate records, I then loop thru them and
make a few slight adjustments to some of the other datacolumns to identify
them more to the current new project at hand. Now I want to do
dataadapter.update to put these records into the actual task Table2. Now
this works great, the new tasks are inserted and the identity columns are
obviously udpated to the Table2's latest autonumbers. The problem i have run
into is the parentID field. In the template Table1, they reference the
correct parent record, but once in the new Table2, the parentID column data
is still the static data that it was in the template Table1. I am trying to
find a way to keep this relation from Table1 into Table2 so that the new
records in Table2's parentIDs reference the new autonumber fields that keep
them tied to the appropriate parent tasks.
I've read much about creating DataRelations, Constraints but I just can't
get the formula correct, or maybe its not even the right way to do this.
I'm looking for any ideas or experiences that would lead me to the answer
here, the solution to this problem that has tied me up for a good 8 hours
now.
Thanks for any help
jon