DataSet with multiple relations to

J

Jonas

Hi!

I'm using a typed dataset where I have a common address table which is
related to several other tables in the dataset, see below:

Table Incident:
- PK
- FK_incidentAddress - relation to Address.PK
- FK_destinationAddress - relation to Address.PK
....

Table Person:
- PK
- FK_homeAddress - relation to Address.PK
....

Common table Address
- PK
- Street
- City
.....

If I use one Address entity in the dataset, I guess that I'll get problems
as one row in Address can not satisfy all the relations specified. If I
instead create multiple Addresses which I give different names, and the
relate each of them to their parent, I get ConstraintExceptions when trying
to enable constraints in the dataset after merging the child rows. It seems
like it is the rename of a Address table that creates my problem.

Any tips?

Brgds

Jonas
 
M

Miha Markic [MVP C#]

Hi Jonas,

If I use one Address entity in the dataset, I guess that I'll get problems
as one row in Address can not satisfy all the relations specified.

No problems there. The address row doesn't need to satisfy all relations, or
better, it doesn't need to satisfy any relation.
On the other hand, if you put some value into, for example,
FK_incidentAddress, there has to be related row in Address table.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

If I
 
J

Jonas

Hi Miha,

thank you for your very fast response. I tried it, and it worked like a
charm. I guess that I complicated the problem before trying out the simplest
solution :-/

Thanks

Jonas



Miha Markic said:
Hi Jonas,

If I use one Address entity in the dataset, I guess that I'll get
problems as one row in Address can not satisfy all the relations
specified.

No problems there. The address row doesn't need to satisfy all relations,
or better, it doesn't need to satisfy any relation.
On the other hand, if you put some value into, for example,
FK_incidentAddress, there has to be related row in Address table.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

If I
instead create multiple Addresses which I give different names, and the
relate each of them to their parent, I get ConstraintExceptions when
trying to enable constraints in the dataset after merging the child rows.
It seems like it is the rename of a Address table that creates my
problem.

Any tips?

Brgds

Jonas
 

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