Re: Creating a DataRelation by Jay
Jay
Fri Jul 23 09:31:07 CDT 2004
Roshawn,
As Miha suggests, it doesn't matter.
I normally create them based on the needs of my project. In one project I
create all the DataTables, then all the DataRelations, then I fill the
dataset. In another project I create the parent DataTables, then as I create
a child DataTable I create that child DataRelation.
Note I normally create the PrimaryKey constraints & the DataRelation
explicitly, allowing the framework create any ForeignKeyConstraints &
UniqueConstraints implicitly as a side effect of creating the
DataRelation...
For strongly typed data sets they will be created when you instantiate a new
strongly typed dataset.
Also you can use DataSet.EnforceConstraints to control if the constraint is
enforced while filling a dataset, thus controlling if an exception is thrown
or not.
> (according to ADO.NET Core Reference).
I was going to recommend Sceppa's book, but it sounds like you already have
it ;-)
Hope this helps
Jay
"Roshawn" <udrago@bellsouth.net> wrote in message
news:eq1984LcEHA.3716@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> Creating a DataRelation among two tables seems to be pretty simple
> (according to ADO.NET Core Reference). However, I'm not sure of the best
> time to create it. Is it better to create the DataRelation between the
> tables after the tables have been filled, or is it better to create
> ForeignKeyConstraints when creating the columns of each table?
>
> Roshawn
>
>