U
unknown;
hello,
my question is about relations and about refreshing datatable after a
update.
i've got 2 tables in a MSSQL database. tblOrder (parent) and
tblOrderProduct (child)
tblOder has a column ID <bigint, primary key, auto increase> and
tblOrderProduct also has a column ID<bigint, primary key, auto
increase> and a column OrderID which is the foreignkey to tblOrder.ID.
with a sqlAdapter and 2 sql-select-statements i fill 2 local
datatables from 1 dataset. i also make a relation on tblOrder.ID and
tblOrderProduct.OrderID. (whitch automaticly makes 2 constraints
( foreignkey constraint and unique constraint))
When i add an order (1 row into the ordertable and 3 rows into the
orderProdcut table) all rows have automaticly an ID assigned by the
dataset/datatable. This isn't the problem.
The problem occures when i want to update both tables into the
database and just before i do that an other user has added an order.
When i update my local tblOrder my order will get an other ID in the
database table but in my local table this doesn't change. When my
local tblOrder.ID doesn't change the foreignkeys in the child table
will not change.
When i update my local tblOrderProducts the foreign key isn't set to
the right order.
I hope my problem is clear.
How to fix this??
It's about refreshing my local datatable after an update so that a all
foreignkeys are also updated just before i update that table into the
database.
Thanks in advance!!
I can add an example if necessary
my question is about relations and about refreshing datatable after a
update.
i've got 2 tables in a MSSQL database. tblOrder (parent) and
tblOrderProduct (child)
tblOder has a column ID <bigint, primary key, auto increase> and
tblOrderProduct also has a column ID<bigint, primary key, auto
increase> and a column OrderID which is the foreignkey to tblOrder.ID.
with a sqlAdapter and 2 sql-select-statements i fill 2 local
datatables from 1 dataset. i also make a relation on tblOrder.ID and
tblOrderProduct.OrderID. (whitch automaticly makes 2 constraints
( foreignkey constraint and unique constraint))
When i add an order (1 row into the ordertable and 3 rows into the
orderProdcut table) all rows have automaticly an ID assigned by the
dataset/datatable. This isn't the problem.
The problem occures when i want to update both tables into the
database and just before i do that an other user has added an order.
When i update my local tblOrder my order will get an other ID in the
database table but in my local table this doesn't change. When my
local tblOrder.ID doesn't change the foreignkeys in the child table
will not change.
When i update my local tblOrderProducts the foreign key isn't set to
the right order.
I hope my problem is clear.
How to fix this??
It's about refreshing my local datatable after an update so that a all
foreignkeys are also updated just before i update that table into the
database.
Thanks in advance!!
I can add an example if necessary