Expression Column doesn't refresh

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
 
J

Jeffrey Huntsman

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
 
M

Miha Markic

Hi,

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

Fei

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top