M
moondaddy
I have a dataset which has a parent table and a child table. The parent
table has some expression columns that do things like sum the ExtPrice
column in the child table for a subtotal, calculate tax (tax rate *
subtotal), etc. My problem is when I delete the last row in the child
table:
Dim oCartItem As dsSessionMngr.CartDetailsRow =
GetCartDetailRowByCustRef(sku)
oCartItem.Delete()
Then the expression columns in the parent table don't have a value of zero
or dbnull. Instead, they have some sort of error which looks like this in
the watch window:
SubTotal <error: an exception of type: {System.Data.StrongTypingException}
occurred> Single
and here's how the SubTotal column is defined in the dataset:
<xs:attribute name="Total" type="xs:float" default="0" />
and here's how I setup the expression when I first setup (create a new
instance of...) the dataset
Note:
dsSM is the module variable of the dataset
Cart is the parent table
CartDetails is the child table
CartToCartDetails is the relationship between the 2 tables
ExtPrice is the column in the child table being summed.
dsSM.Cart.SubTotalColumn.Expression =
"Sum(Child(CartToCartDetails).ExtPrice)"
Everything works OK until I remove the last row of data in the child table.
Is there anyway to make the expression columns in the parent table (the ones
dependant on the child table...) have a value of zero when there are no rows
in the child table (similar to a sum function in sql server)?
Thanks.
table has some expression columns that do things like sum the ExtPrice
column in the child table for a subtotal, calculate tax (tax rate *
subtotal), etc. My problem is when I delete the last row in the child
table:
Dim oCartItem As dsSessionMngr.CartDetailsRow =
GetCartDetailRowByCustRef(sku)
oCartItem.Delete()
Then the expression columns in the parent table don't have a value of zero
or dbnull. Instead, they have some sort of error which looks like this in
the watch window:
SubTotal <error: an exception of type: {System.Data.StrongTypingException}
occurred> Single
and here's how the SubTotal column is defined in the dataset:
<xs:attribute name="Total" type="xs:float" default="0" />
and here's how I setup the expression when I first setup (create a new
instance of...) the dataset
Note:
dsSM is the module variable of the dataset
Cart is the parent table
CartDetails is the child table
CartToCartDetails is the relationship between the 2 tables
ExtPrice is the column in the child table being summed.
dsSM.Cart.SubTotalColumn.Expression =
"Sum(Child(CartToCartDetails).ExtPrice)"
Everything works OK until I remove the last row of data in the child table.
Is there anyway to make the expression columns in the parent table (the ones
dependant on the child table...) have a value of zero when there are no rows
in the child table (similar to a sum function in sql server)?
Thanks.