473,761 Members | 5,848 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting subset of a Dataset?

H
I have a dataset with Customers, Orders, and Items tables.
It has datarelations set between Customers-Orders and Orders-Items
It has foreignkeyconst raints 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.

Jun 19 '07 #1
3 2651
On Jun 19, 11:50 am, H <halukdot...@gm ail.comwrote:
I have a dataset with Customers, Orders, and Items tables.
It has datarelations set between Customers-Orders and Orders-Items
It has foreignkeyconst raints 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?

Jun 19 '07 #2
On Jun 19, 1:14 pm, Lucas <lucaslshaf...@ gmail.comwrote:
On Jun 19, 11:50 am, H <halukdot...@gm ail.comwrote:


I have a dataset with Customers, Orders, and Items tables.
It has datarelations set between Customers-Orders and Orders-Items
It has foreignkeyconst raints 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/li...s0(VS.80).aspx

Jun 19 '07 #3
H
On Jun 19, 1:17 pm, Lucas <lucaslshaf...@ gmail.comwrote:
On Jun 19, 1:14 pm, Lucas <lucaslshaf...@ gmail.comwrote:


On Jun 19, 11:50 am, H <halukdot...@gm ail.comwrote:
I have a dataset with Customers, Orders, and Items tables.
It has datarelations set between Customers-Orders and Orders-Items
It has foreignkeyconst raints 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/li...0(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.
Jun 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
17743
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
1
2319
by: Roger Green | last post by:
I have inherited a complex database that has many dozens of queries that derive data from a people table. I now need to be able to run these queries (from within a significant number of forms) not on the full dataset, but on a subset of the data in the people table. I want to avoid having to put criteria in all of the individual queries or forms, or having to change the data source for all the queries. Is there anyway I can restrict...
0
1168
by: Lee Richardson | last post by:
Hi, I have what is probably a fairly simple "best practices" question that I could use help with. I have a Win Forms application that holds it's state in a typed dataset. Part of the dataset (i.e. several of the tables) represents a "document" that I would like the user to be able to save (to a hard drive) and open (back into the dataset). For now I am happy just persisting it as XML, although at some point I will want the XML...
1
2256
by: J | last post by:
This works well for binding a Dataset (created from an XML file) to a DataGrid for the entire 'page' table. However I would like to only grab a few rows from the 'page' table (like: select id, description from page where docid = 1). Any help would be greatly appreciated... because this datagrid thing is kicking my ass. Thank you,
1
3919
by: Oleg Shnayderman | last post by:
Hi All, I am very new to C# as well as to SQL. I need to write an application which is connecting to SQL DB and getting all the user's tables and after create a dataset for all the tables in the database and create an XML document with all the info. The problem is, that I can do this if I know the table name. However, what if I don't know the table name nor I know how many user's tables in the particular database.
6
3190
by: Erik H. | last post by:
Trying to connect to MySQL db on localhost, and populate datagrid from a dataset using code inline method. Getting the following compile error: Error Message: "CS0246: The type or namespace name 'CoreLab' could not be found (are you missing a using directive or an assembly reference?)" I downloaded the add on for connecting to MySQL using ADO.NET and installed it, but am still getting this error. Anybody ever run into this before?
2
2333
by: David Richards | last post by:
Hi, I was wondering if anyone could help me. I have DataSet that contains the following data tables Customers, Calls, Quotes, QuoteDetails, Competitors, Contacts, Notes, and I have setup relationships betweenthem. Each row in the customer's data table contains an area number. What I would like to do is export all records for specific area to an XML file.
1
1304
by: crimanysakes | last post by:
Someone should write a FAQ on how to grab various "latest dates" from MySQL; cuz I'm quite confused. Not sure how much to include; but here' my query to get my first "subset" of data: select caseResults.* from caseResults, runs, scriptResults where runs.runID = scriptResults.runID and runs.runID in (476,477,479,480) and scriptResults.scriptResultID = caseResults.scriptResultID order by caseResults.caseID This will return; for example a...
4
1482
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Why am I getting an error when I passed by ref a dataset to a new form? The message reads "cannot convert from 'ref Paimport.unixAccount' to 'ref System.Data.DataSet'. Paimport is the name of the form where the dataset UnixAccount is created. I created the dataset using the designer tool and not by code. So it's like a type or class which I then declare an instance of it : UnixAccoutns dsAccounts = new UnixAccoutns (); I pass to a new...
0
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10111
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.