Expression Column doesn't refresh

  • Thread starter Thread starter Fei
  • Start date Start date
F

Fei

Hi,

I have a problem. I have no any clue about this. Please help me to figure
it out.

I have a Customers table and Orders table. There is a relation,named
"Customer2Orders", between Customers (parent table) and Orders (child table)
on CustomerID. One Customer may have multiple Orders. I have an expression
column 'Total' in Customers table. It is computed based on the child table's
column InvoiceAmount, i.e. Total =
Sum(Child(Customer2Orders).InvoiceAmount). If I add a child record, Total is
computed automatically. But if I delete a child record, Total is not
reflected. It still keeps the old value which is wrong.

Thanks in advance!

Fei
 
I'd bet that you would need to update the dataset in order to see the
change. This is because when you Delete a row, it is not physically deleted.
It still exists in the Rows collection, just that it's state has been
changed.

2 solutions: physically update the dataset using your DataAdapter.Update
method, or just call DataSet.AcceptChanges and see if your total is then
computed correctly.

Jeffrey
 
Hi,

I would avoid using expressions when editing dataset.
Rather, compute it by yourself.
 
Jeffrey,

Thanks for your suggestions!
I did try. But both solutions don't work. I use Infragistics grid, and
delete one child record from grid, then I do update, and acceptchanges. It
didn't work.

Fei
 
Back
Top