Board index » Visual Studio » getting subset of a Dataset?

getting subset of a Dataset?

Visual Studio72
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.


-
 

Re:getting subset of a Dataset?

On Jun 19, 11:50 am, H <halukdot...@gmail.com>wrote:

Quote
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?



-

Re:getting subset of a Dataset?

On Jun 19, 1:14 pm, Lucas <lucaslshaf...@gmail.com>wrote:

Quote
On Jun 19, 11:50 am, H <halukdot...@gmail.com>wrote:











>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?- Hide quoted text -



- Show quoted text -



https://msdn2.microsoft.com/en-us/library/tzwewss0(VS.80).aspx



-

Re:getting subset of a Dataset?

On Jun 19, 1:17 pm, Lucas <lucaslshaf...@gmail.com>wrote:

Quote
On Jun 19, 1:14 pm, Lucas <lucaslshaf...@gmail.com>wrote:











>On Jun 19, 11:50 am, H <halukdot...@gmail.com>wrote:



>>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?- Hide quoted text -



>- Show quoted text -



https://msdn2.microsoft.com/en-us/library/tzwewss0(VS.80).aspx- Hide quoted text -



- Show quoted text -



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.





-