If I create a child relationship between 2 tables, but the parent table has a
value which is not found in the child table, then this will cause an
exception....right? So how to I indicate that the parent/child relationship
may or may not exists so that no exception is generated when that occurs?
Sahil Malik [MVP] - 26 May 2005 20:45 GMT
Well if the data doesn't satisfy the relation - then you can't create the
relation :-). Otherwise the relation would be no use .. right?
You can try using a nullable FK though.
- Sahil Malik [MVP]
http://codebetter.com/blogs/sahil.malik/
> If I create a child relationship between 2 tables, but the parent table has a
> value which is not found in the child table, then this will cause an
> exception....right? So how to I indicate that the parent/child relationship
> may or may not exists so that no exception is generated when that occurs?
Thor Kornbrek - 01 Jun 2005 00:02 GMT
If you are using an instance of the DataRelation class you can pass a
parameter in the constructor telling ado.net not to enforce constraints.
Documentation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemdatadatarelationclassctortopic3.asp

Signature
Thor Kornbrek
.Net Developer
> If I create a child relationship between 2 tables, but the parent table has a
> value which is not found in the child table, then this will cause an
> exception....right? So how to I indicate that the parent/child relationship
> may or may not exists so that no exception is generated when that occurs?