ADO.NET - Using DataRelations to propogate data

S

Spatz

Hello,

I'm having a problem with a DataRelation that I created. It does not
propogate data to the child table when I update the parent table (as
it should). I've done this many times before but the difference is
that I've typically used them on PrimaryKeys and in a very straight
forward manner.

In this case, however, I am doing two different things. I don't even
know if they are the cause, but they are all i can think of now.

1) First, the columns in the parent and child are byte[]. This
shouldn't matter I would think because doesn't ADO.NET simply slam the
values regardless of the datatype? Or does it have to be a value
datatype?

2) The column does not have a constraint (and cannot).

Is #2 the problem, or is #1 or something else?

Thanks in advance if anyone has some tips.

Here is a simple example of my code:

// Parent (CreateTable method)
....
tbl.Columns.Add("ts", typeof(byte[]));
....

// Child (CreateTable method)
....
tbl.Columns.Add("ts", typeof(byte[]));
....

// Create Relation
m_ds.Tables.Add(parentTable);
m_ds.Tables.Add(childTable);
m_ds.Relations.Add("TimeStampRelationShip", parentTable.Columns["ts"],
childTable.Columns["ts"], false)

Funny thing is that when I pass the last parameter as true, it throws
this error on that line:
"These columns don't currently have unique values."

which cannot be the case because I've physically checked the values of
the byte[]'s in both the parentTable and childTable all the rows are
unique, plus the child rows values all exist in the parent rows. This
leads me to speculate if a dataRelation can only be on Value
datatypes. If this is true, would there be some sort of cool .NET way
to create a new class that somehow derives from a byte[] and I would
override (either) the equals operator and/or the ToString(). That is,
whichever the DataRelation uses to determine equality.

Thanks for anyone's help in advance!

Tom
 
I

IbrahimMalluf

Hello Spatz

The parent table's column that is the foreign key column in the child table
must be unique. Or in the case of multple column relationships must be a
Primary key so that all keys are unique.



--
Ibrahim Malluf
http://www.malluf.com
==============================================
MCS Data Services Code Generator
http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
==============================================
Pocket PC Return On Investment Calculator
Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx
 

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