Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
OK I have a bunch of data that I have collected from a number of sorces(sybase, Oracle, xml files). I have gathered them into a single dataset with table names. All tables that I have gathered contains information for a device by date and by hour. Now I am looking to get the information out of the dataset in a simple way. If the data was in a database with tables I would just use inner join statements in order to get the information that I wanted but from what I've found the .getchildrows and .getparentrows are the only real ways to join dataset tables, and I believe that you can only relate two tables at a time(parent/child) using those commands. Is there a way to query all tables at once. If not, are there any suggestions on how I go about this.......I was hoping for an easy way but if looping through the tables is the only way I will do that.
  • *Experts*
Posted

There is no built-in way to query across tables or to join tables at all, with DataSets. Four options come to mind, none are "ideal", but ah well...

 

1. Use Linq or dlinq (part of C# 3.0) that lets you do exactly what you want - query across... well, just about anything. This is still in beta, so it may not be an option for you.

 

2. Add expression columns to one of the tables that point to the other tables - essentially make TableA have columns from TableB. Every column would have to be setup that way and expression columns tend to have quirks about their usage (some things, like HasChanges(), may not work correctly).

 

3. Manually add columns from TableB to TableA so that TableA has all of the values. This is totally manual. In the end, you could delete TableB as all of its data would be in TableA.

 

4. Try another option, like a JoinView. I played around with this a few years ago - I even ported it to C# without too much trouble. It may be what you want, but again, it's a custom solution - probably worth weighing against the more manual options, such as #3.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...