getting subset of a Dataset?

  • Thread starter Thread starter H
  • Start date Start date
H

H

I have a dataset with Customers, Orders, and Items tables.
It has datarelations set between Customers-Orders and Orders-Items
It has foreignkeyconstraints with update/delete rules set to cascade
for Orders & Items.

The dataset is filled with Customers and their related Orders and
their related Items.

What is the most efficient way to create a second dataset that is a
subset of the main dataset, but only has data for Customer_id = "1"
and its' related Orders and Items?

I have no control over the creation and population of the main
dataset, therefore, I need to filter and copy data to another dataset.

Since all relationships and constraints are already set, is it
possible to set a filter where I can say Customer_id="1" and have all
of the other tables automatically filter as well?

thanks.
 
I have a dataset with Customers, Orders, and Items tables.
It has datarelations set between Customers-Orders and Orders-Items
It has foreignkeyconstraints with update/delete rules set to cascade
for Orders & Items.

The dataset is filled with Customers and their related Orders and
their related Items.

What is the most efficient way to create a second dataset that is a
subset of the main dataset, but only has data for Customer_id = "1"
and its' related Orders and Items?

I have no control over the creation and population of the main
dataset, therefore, I need to filter and copy data to another dataset.

Since all relationships and constraints are already set, is it
possible to set a filter where I can say Customer_id="1" and have all
of the other tables automatically filter as well?

thanks.

just a thought but have you tried to create a datatable instead of
dataset, then requesting the column/row data and moving that
information into new dataset?
 

Similar to your suggestion, I know that I can also create a clone
dataset from the main dataset, and then just iterate through the
tables of the main dataset adding only the necessary rows to the clone
dataset. It's doable, but it's a process of keeping track of primary
keys, foreign keys, etc.

I was just wondering if there was a quick ado.net way that would let
me create a new subset dataset that is filtered based on a select
statement passed to the main dataset.
 
Back
Top