Queries against a dataset

T

Tobe

Is there anyway to run a query against a dataset in
ADO.NET? For example, I have two tables already in a
dataset, is there anyway to do a join on those two tables
and get a resulting table?

This would be especially useful for:
1. tables in two different databases, or
2. joins on tables already in memory without hitting the
database again.
 
C

Cowboy \(Gregory A. Beamer\)

Convert to XML and manipulate, or write another query to return another
table in your DataSet. There is no way, currently, to make a view across two
DataTables. You can filter the results, with a DataView, but only on one
table.

I would imagine this functionality will rear its head in the future, as many
people are asking for it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

****************************************************************************
****
Think Outside the Box!
****************************************************************************
****
 
N

Neil Allen

Is there anyway to run a query against a dataset in
ADO.NET? For example, I have two tables already in a
dataset, is there anyway to do a join on those two tables
and get a resulting table?

This would be especially useful for:
1. tables in two different databases, or
2. joins on tables already in memory without hitting the
database again.

Dear Tobe

To begin with I found it difficult not to think of a dataset as a mini
database and, therefore, that I should be able write SQL queries. But
it ain't so I can't.

Under *some* circumstances you might find that data table columns
defined as expressions are a solution. A "child" row can refer to its
parent's columns (e.g. a row with, say, an "account number" foreign
key can display the corresponding "account name"). Similarly, a
"parent" row can display aggregated results (sum, avg etc) from its
child rows. Expression type columns can be included in strongly typed
data sets - if you use them.


Another possibility is the use of a helper class to (sort of) emulate
a SQL Query with a join.

Here's a, potentially, useful reference...

http://support.microsoft.com/default.aspx?scid=kb;en-us;326080


Regards

Neil Allen
 

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