468,780 Members | 2,318 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,780 developers. It's quick & easy.

Expression column values doesn't recalulate on delete

I have two tables(Vendors and OpenInvoices). Added one
relation(Vendor2Invoices). Added one Computed column(Total Amount) in Vendor
table which is sum of Invoice amount in child table(OpenInvoices). When I
change the Invoice amount in child table, computed column value changes,
which is ok, but when I delete rows in child(openInvoices) table then
computed column doesn't recalculate.

Please advise what I have to do to recalculate on delete.

Dim ds As New DataSet
Dim daVendors As New SqlClient.SqlDataAdapter("select * from
vendors", "server=csql;database=cssdata;uid=aakarg;password= priya")
daVendors.Fill(ds, "Vendors")
Dim daOpenInvoices As New SqlClient.SqlDataAdapter("select * from
OpenInvoices", "server=csql;database=cssdata;uid=aakarg;password= priya")
daOpenInvoices.Fill(ds, "OpenInvoices")
ds.Relations.Add("Vendor2Invoices",
ds.Tables("Vendors").Columns("VendorID"),
ds.Tables("OpenInvoices").Columns("VendorID"))
Dim col As New DataColumn
col.DataType = GetType(Double)
col.ColumnName = "Total Amount"
col.Expression =
"isnull(sum(child(Vendor2Invoices).InvoiceAmount), 0)"
ds.Tables("Vendors").Columns.Add(col)
Me.DataGrid1.DataSource = Me.ds.Tables("Vendors")
Thanks, Kartic
Nov 20 '05 #1
0 955

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by Paul Rubin | last post: by
3 posts views Thread by Edward Mostrom | last post: by
4 posts views Thread by perspolis | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.