Combining and relating DataTables from different typed DataSets in

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We have been provided with a set of typed DataSets which we wish to merge
into the one DataSet, adding any additional relationships between DataTables
as appropriate. We wish to use Visual Studio.NET 2005 to visualise and
manipulate the various tables in order for all of the typed methods that deal
with relations to be generated on the DataTables within the final DataSet.

We believe that it is possible to modify the DataSet schema file to import
and extend DataTables from other DataSets but we are unable to successfully
implement this. The article at
http://www.devx.com/dotnet/Article/20945/0/page/1 was very useful but failed
to give us the level of information required.

Our scenario is as follows:

* A DataSet 'DataSet1' contains a DataTable 'Table1' with a primary key
column 'Table1PK'
* Another DataSet 'DataSet2' contains a DataTable 'Table2' which contains a
primary key column 'Table2PK' and a foreign key column 'Table1FK'

We wish to, through the visual designer or (most likely) directly in the XSD:

* Import Table1 into DataSet2
* Add a relation between Table1FK in Table2 and Table1PK in Table1 in DataSet2
* Automatically generate the typed methods on imported Table1 and Table2
corresponding to the relation between them

We wish to reference rather than replicate Table1 in DataSet2 so that any
changes that may be made to Table1 in DataSet1 propagate through to DataSet2.

Please could an expert point us in the right direction, or supply some
examples as to how the above may be achieved?

Thanks,

Marc
 
Marc,

A strongly typed dataset is nothing more then a class created (wrapped)
around an dataset.
If you open in your solution explorer in top Show all files (it is an icon
not always visible), then you will see that.

It is easy to combine non strongly typed dataset, by just adding the table
to that and set the relation. You even can do that with a strongly typed
dataset, however in the latter you can then not use the strongly typed
members from those however have to use it non strongly typed.

Cor
 
Back
Top