R
rmorvay
I have three tables in a dataset that I need to relate. I know how to
relate two tables but going beyond that is, quite frankly, beyond me. Any
insight? Here is the C# code that I did for a two table relate. I need to
relate TerritoryExceptionColumns as well:
DataColumn[] TerritoryColumns;
DataColumn[] TerritoryExceptionTypeColumns;
DataColumn[] TerritoryExceptionColumns;
TerritoryColumns = new DataColumn[]
{dsTerritory2.Tables["Territory"].Columns["TerritoryID"],
dsTerritory2.Tables["Territory"].Columns["ExceptionType"]};
TerritoryExceptionTypeColumns = new DataColumn[]
{dsTerritory2.Tables["TerritoryExceptionType"].Columns["TerritoryID"],
dsTerritory2.Tables["TerritoryExceptionType"].Columns["ExceptionType"]};
TerritoryExceptionColumns = new DataColumn[]
{dsTerritory2.Tables["TerritoryException"].Columns["TerritoryID"],
dsTerritory2.Tables["TerritoryException"].Columns["ExceptionType"]};
DataRelation drelTerritory = new DataRelation("Territory",
TerritoryColumns, TerritoryExceptionTypeColumns);
dsTerritory2.Relations.Add(drelTerritory);
Thanks in advance.
relate two tables but going beyond that is, quite frankly, beyond me. Any
insight? Here is the C# code that I did for a two table relate. I need to
relate TerritoryExceptionColumns as well:
DataColumn[] TerritoryColumns;
DataColumn[] TerritoryExceptionTypeColumns;
DataColumn[] TerritoryExceptionColumns;
TerritoryColumns = new DataColumn[]
{dsTerritory2.Tables["Territory"].Columns["TerritoryID"],
dsTerritory2.Tables["Territory"].Columns["ExceptionType"]};
TerritoryExceptionTypeColumns = new DataColumn[]
{dsTerritory2.Tables["TerritoryExceptionType"].Columns["TerritoryID"],
dsTerritory2.Tables["TerritoryExceptionType"].Columns["ExceptionType"]};
TerritoryExceptionColumns = new DataColumn[]
{dsTerritory2.Tables["TerritoryException"].Columns["TerritoryID"],
dsTerritory2.Tables["TerritoryException"].Columns["ExceptionType"]};
DataRelation drelTerritory = new DataRelation("Territory",
TerritoryColumns, TerritoryExceptionTypeColumns);
dsTerritory2.Relations.Add(drelTerritory);
Thanks in advance.