?
Solved

question about using datasets

Posted on 2006-06-10
9
Medium Priority
?
193 Views
Last Modified: 2010-04-23
If I have a dataset with a bunch of datatables in it, is there a way I can execute a sql statement against the dataset?

Something like select a.id,b.name
from accounts as a
left join names as b on b.id = a.id

If so, can someone show me what is required to get this data from the dataset?

Thanks
Rut
0
Comment
Question by:rutledgj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 16879714
Here's something that was used in a PAQ.  You can set a row filter to return only some of the rows, but if you're going to be doing some major re-querying, you're probably better off just getting it from the database again.

     Dim strWinnerPhone As String = "5551234"
     Dim strWinnerPhone2 As String = "5555678"
     Dim dvNonWinners As New DataView(dsEntries.Tables(0))

     'Simulates "SELECT * FROM dsEntries.Tables(0) WHERE PhoneNumber <> Phone#1 AND PhoneNumber <> Phone#2"
     dvNonWinners.RowFilter = "PhoneNumber <> " & strWinnerPhone & " and PhoneNumber <> " & strWinnerPhone2
     DataGrid2.DataSource = dvNonWinners
0
 
LVL 11

Expert Comment

by:anyoneis
ID: 16879753
There is no concept of joins between tables in a dataset.

David
0
 
LVL 44

Expert Comment

by:bruintje
ID: 16879855
in addition to the above comments there is a PAQ with some alternatives posted by Dhaest
http://www.experts-exchange.com/Q_21480064.html
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rutledgj
ID: 16881210
I thought the whole point of using datasets was so you could work in an offline mode. They aren't very useful if you can't join the tables in the ds.
0
 
LVL 11

Expert Comment

by:anyoneis
ID: 16881312
Perhaps your application needs something like SQL Express, so that you can have a more online offline mode of operation?

>>Something like select a.id,b.name
>>from accounts as a
>left join names as b on b.id = a.id

You could loop through accounts, and for each one pull out the matching names row using DataTable.Select.

David
0
 
LVL 11

Expert Comment

by:anyoneis
ID: 16881334
bruintje: That's a slick link! Thanks!
0
 

Author Comment

by:rutledgj
ID: 16881667
I'm actually loading the datasets from a sql server table. I didn't want to have 4000 hits to the database to process data. Instead I was hoping I could load the tables in a ds and process them offline. Guess that won't work.

0
 
LVL 9

Accepted Solution

by:
tolgaong earned 400 total points
ID: 16884591
you can define relations in datasets.

see
dim ds as new dataset1
ds.Relations.Add("a name", parentFields as string(), childFields as string())


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question