473,609 Members | 2,296 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query results from multiple table dataset

Hi people,
I'd like to know if it's possible to get DataRows containing data
from different tables that are part of one single dataset?

Example:

Dim ds As New DataSet("myData Set")

'Load 3 tables with data from my DB
Dim tblEmployees As DataTable = FetchEmployeeDa ta() 'Table name =
"Employees"
Dim tblEmployeeDeta ils As DataTable = FetchEmployeeDe tailsData()
'Table name = "EmployeeDetail s"
Dim tblTasks As DataTable = FetchTaskData() 'Table name = "Tasks"

ds.Tables.Add(t blEmployees)
ds.Tables.Add(t blEmployeeDetai ls)
ds.Tables.Add(t blTasks)

Dim str() As String
'Infer a schema that define the relations between tables based on the
EmployeeSchemaP ath constant value
ds.InferXmlSche ma(EmployeeSche maPath, str)

ds.Select(???) ?
Am I on the right path?

Any suggestions?

Thanks a lot for reading!

Nov 30 '05 #1
2 1499
There is also a merge property...

"Stef" <st************ @mittalsteel.co m> schreef in bericht
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hi people,
I'd like to know if it's possible to get DataRows containing data
from different tables that are part of one single dataset?

Example:

Dim ds As New DataSet("myData Set")

'Load 3 tables with data from my DB
Dim tblEmployees As DataTable = FetchEmployeeDa ta() 'Table name =
"Employees"
Dim tblEmployeeDeta ils As DataTable = FetchEmployeeDe tailsData()
'Table name = "EmployeeDetail s"
Dim tblTasks As DataTable = FetchTaskData() 'Table name = "Tasks"

ds.Tables.Add(t blEmployees)
ds.Tables.Add(t blEmployeeDetai ls)
ds.Tables.Add(t blTasks)

Dim str() As String
'Infer a schema that define the relations between tables based on the
EmployeeSchemaP ath constant value
ds.InferXmlSche ma(EmployeeSche maPath, str)

ds.Select(???) ?
Am I on the right path?

Any suggestions?

Thanks a lot for reading!

Nov 30 '05 #2
Pipo,
thank you for your quick answer.
Unfortunately, I don't see how .Merge can help in my situation because
I want to grab data from an employee and extract everything related to
him so I can fill a grid with those values or else, create an instance
of an employee class I made, etc...

Maybe I'm missing something?

If you still believe .Merge is the way to go, can you provide me with
an example?
I have checked MSDN examples about .Merge and tried some things but it
doesn't look like it's a solution that fits well my needs...

Thanks!

Nov 30 '05 #3

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

Similar topics

7
4004
by: Phin | last post by:
I need your HELP! I've seen all the posts on using Crystal Reports within vs.net (vb.net) and changing a SQL query at runtime. When I tried to pass in a dataset into the crystal report at runtime, the report still showed the results from the default query (from within the Crystal Report). Then I tried the XSD solution where you define a dataset (that mataches the database and the Crystal Report) and have the Crystal Report use this....
1
6576
by: Charlie | last post by:
Hello, I have data in an Access table that I would like to export to multiple HTML tables. I would like to split the data in the Access table (about 92,000 records) into multiple HTML tables/files to reduce download time and bandwidth usage on my web server. That way, the user can select a particular page to download instead of downloading a page with all of the records. I would like to set a limit of only 500 records per file.
2
15049
by: Scott Cannon | last post by:
I am trying to query 3 tables all related by Clinet_ID. The Clients table, Monthly_Expenses table and Monthly_Income table. Each client can have 0>M instances of expenses, past due expenses, and income so I am using the SUM aggregate function to get the totals for the Monthly_Epenses.Amount, Monthly_Expenses.Past_Due_Amount, and Monthly_Income.Amount. Then problem I am having and cannot seem to resolve is that the Monthly_Income is...
2
5866
by: Matthew Kramer | last post by:
Once you have created a table through a query, is there a way to make that dataset into an Access "table" rather than a table/dataset generated by a query? Maybe someway to cut and paste the results of the query into a table? Also, if you're in a table and you run a filter and have the rows you like - is there a way to copy those results into a new table? I know in excel, after you've done a filter and have the rows you're looking...
3
1824
by: Andrew Bourne | last post by:
I would like to insert multiple records into a table based on a query returned from the same table. For example a datareader returns 3 records containing the following records user1 file1 group1 user1 file2 group1 I would then like to insert records into the table based on the datareader but change the last field to the
1
2015
by: cindy | last post by:
Get data into datatable, add to dataset dsSearch " Get data into datatable, add to dataset dsSearch Using In-Memory SQL Engine join the tables and select the filenames from the join, add to dataset dsSearch CODE ON http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3994&lngWId=10 using SQL connection get data from view on sql server, add to dataset dsSearch
4
2527
by: dancole42 | last post by:
So I have an invoicing database based on two main forms: Orders and OrderLines. Orders has fields like: OrderID BillingMethod OrderDate CreditCard CCExp OrdSubTotal ShippingCharge
3
2022
by: sar68 | last post by:
I'm using Access 2007 on windows vista. Intel T7400 with 2.16 GHz and 2 gigs of ram. 64 bit os. If I run a query that goes across multiple tables, I get sensible results. However, if I run a query in only one table, I get duplicate results. In fact I get over 300 repetitions of each result. This only occurs when I use multiple fields. The database I'm using is a large collection of info on boating accidents. I was trying to get a list...
3
1578
by: t8ntboy | last post by:
I have a table that contains a field for the start time for each day of the week (e.g., MondayStart, TuesdayStart, WednesdayStart, FridayStart, SaturdayStart, SundayStart). I need a query that yields the first start time from any of the days. The problem is that, in many cases/records, there is not start time at all, or there are start times on multiple days. Some meetings may only be on Monday where others may be on Tuesday and...
0
8126
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
8065
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,...
1
8210
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8394
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...
0
6990
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6052
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
5507
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
4074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2527
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.