Query results from multiple table dataset

S

Stef

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("myDataSet")

'Load 3 tables with data from my DB
Dim tblEmployees As DataTable = FetchEmployeeData() 'Table name =
"Employees"
Dim tblEmployeeDetails As DataTable = FetchEmployeeDetailsData()
'Table name = "EmployeeDetails"
Dim tblTasks As DataTable = FetchTaskData() 'Table name = "Tasks"

ds.Tables.Add(tblEmployees)
ds.Tables.Add(tblEmployeeDetails)
ds.Tables.Add(tblTasks)

Dim str() As String
'Infer a schema that define the relations between tables based on the
EmployeeSchemaPath constant value
ds.InferXmlSchema(EmployeeSchemaPath, str)

ds.Select(???) ?


Am I on the right path?

Any suggestions?

Thanks a lot for reading!
 
S

Stef

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top