Editing Parent Table does not update Child Table... inconsistent behaviour.

Editing Parent Table does not update Child Table... inconsistent behaviour.

Post by dafunk200 » Sat, 28 Feb 2004 14:14:50


[If someone has already addressed this issue, please let me know in
detail as I have actually searched all of microsft.public.dotnet.* for
an answer and couldnt find it anywhere]

Hello again...

I have the following problem:

Lets say I have a Parent DataTable (ID, col1) and a child DataTable
(ID, col2) where there is a relation on the ID's and the childTable
col2.expression = "Parent.col1 * 10"

If I change the value of col1 in the Parent Table (via DataGrid), the
changes are not seen in col2 of the Child Table. (It should be 10*new
value entered)

Furthermore, if I move focus to another DataGrid cell, the edited
value changes back to its original value.

The DataTable is NOT read-only. Values in col1 are able to change
properly when I dont have a child table.

whats going on? (Note that this problem is NOT the same as MS'
documented BUG on Changing ChildTable Key's ..... )

I am able to post some code if you wish, but it doesnt take a genius
to understand whats going on: Changing a value in Parent Table col1
DOES NOT update the value in Child Table col2, even if
col2.expression="Parent.col1"

Is it only me or does it seem that the DataRelation and the DataColumn
classes are written by a bunch of underpaid sloppy university interns?
(like me)

nothing seems to working, i have found sooo many brickwalls which I
believe to be bugs.

Hopefully someone can let me see the light and convince me that I am
just not using ADO.NET properly, and that NO, ADO.NET IS written
professionally and bug-free.

I need help! oh ya, if you get the chance, i have addressed 2 other
issues in a previous posting and no one has replied as of yet...

i will appreciate any help provided.
 
 
 

Editing Parent Table does not update Child Table... inconsistent behaviour.

Post by Miha Marki » Sat, 28 Feb 2004 18:22:49

Hi

I warmly recommend you agains expression columns in master-detail
relationship.
Instead use ColumnChanging event and do the calculations yourself.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

 
 
 

Editing Parent Table does not update Child Table... inconsistent behaviour.

Post by dafunk200 » Wed, 03 Mar 2004 10:08:54

Thank you for your recommendation.

I have basically removed all the parts of my code that set the
"expression" property.

All of the DataTables are calculated manually, which is SURPRISINGLY
much faster. (no DataRelations anymore)

I have no Master-detail relationships, and I basically just fully
recalculate a DataTable when necessary.

It runs faster... no more problems with ADO.NET.

Too bad DataRelation, Expression, etc do not work as advertised
because it would have saved me all of the manual labor. maybe in VS
200x?
 
 
 

Editing Parent Table does not update Child Table... inconsistent behaviour.

Post by Miha Marki » Wed, 03 Mar 2004 16:38:49

Hi,

You can leave DataRelations in place - they are useful for client side
processing and prevents errors before you try to commit data to database.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com