S
s.bussing
Hi, I'm still strugling with the following situation.
I've got two table which are related by a foreign key contraint. These
table reside in a typed dataset. I working on a webbased app, so a
disconnected environment. Now, when I add a row to the parent table and
add rows to the childtable (think of customer and orders). This means
that I have to use the autogen. id of the parenttable and use this Id
as de FK for the childtable.
Then when updating the database, I have to retrieve the new Id from de
customer table from de db and use this id to update the FK in the
childtable before I can add the rows to the db.
In 1.1 for this I used the RowUpdating and RowUpdated event. The above
example is very basic, in my situation I had to update multiple
depending tables. This forced me to use the RowUpdating and RowUpdated
methods. I als used the dataadapter.update to update the typed dataset.
I can not rely on the Id generated by the typed dataset, because an
other person can also add a customer and orders at the same time. To
uniquely create an Id, I set the prim.key in the parent to a seed of -1
starting from -1. The neg. numbers are replaced with the new db Id as
described in the example above.
Now, do I have to use the same construction in 2.0 or is it better to
use tableadapters instead? If yes, how can I use them in such a way the
same functionality is there as in my 1.1 app?
I've got two table which are related by a foreign key contraint. These
table reside in a typed dataset. I working on a webbased app, so a
disconnected environment. Now, when I add a row to the parent table and
add rows to the childtable (think of customer and orders). This means
that I have to use the autogen. id of the parenttable and use this Id
as de FK for the childtable.
Then when updating the database, I have to retrieve the new Id from de
customer table from de db and use this id to update the FK in the
childtable before I can add the rows to the db.
In 1.1 for this I used the RowUpdating and RowUpdated event. The above
example is very basic, in my situation I had to update multiple
depending tables. This forced me to use the RowUpdating and RowUpdated
methods. I als used the dataadapter.update to update the typed dataset.
I can not rely on the Id generated by the typed dataset, because an
other person can also add a customer and orders at the same time. To
uniquely create an Id, I set the prim.key in the parent to a seed of -1
starting from -1. The neg. numbers are replaced with the new db Id as
described in the example above.
Now, do I have to use the same construction in 2.0 or is it better to
use tableadapters instead? If yes, how can I use them in such a way the
same functionality is there as in my 1.1 app?