471,082 Members | 1,206 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,082 software developers and data experts.

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 978

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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.