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

C

Cip

[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.
 
M

Miha Markic [MVP C#]

Hi

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

Cip

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?
 
M

Miha Markic [MVP C#]

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

Cip said:
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?

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi

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

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