I have data from two different databases which I want to join together. If
I create one Datatable with the results of one query and another Datatable
with the results of the second query, can I somehow join the 2 Datatables to
produce a result which will look like I had executed a single query to return
a single datatable?

Re: Data Table Joins by Adrian

Adrian
Thu May 26 09:32:31 CDT 2005

You might be interested in the assembly I've been working on at
http://www.queryadataset.com. Besides INNER JOINS, it lets you perform
complex SQL SELECT statements including UNION, OUTER JOINS, GROUP BY,
HAVING, ORDER BY, sub-queries, etc against the tables in a dataset.

DataSet ds; //contains your DataTables from different sources

DataView dv = QueryADataSet.DsCommand.Execute("SELECT t1.col1, t2.col2 FROM
table1 t1 join table2 t2 on t1.key=t2.key", ds);

It sure saves having to write a lot of DataRelation, GetChildRow and
GetParentRows code. Its the piece of technology Microsoft left out of
ADO.NET.

The web-site allows you to upload your own XML data fragment, DataSet or
resultset and issue queries using the QueryADataSet assembly. If the query
returns the results you expect, then this assembly might be what you are
looking for. Note the result of any query from this assembly is a standard
DataView object; perfect for presentation.

Hope this helps
Ad.

"Jim Heavey" <JimHeavey@discussions.microsoft.com> wrote in message
news:F425CACD-FA34-43BD-AB95-4763A73DB75C@microsoft.com...
>I have data from two different databases which I want to join together.
>If
> I create one Datatable with the results of one query and another Datatable
> with the results of the second query, can I somehow join the 2 Datatables
> to
> produce a result which will look like I had executed a single query to
> return
> a single datatable?



Re: Data Table Joins by Patrice

Patrice
Thu May 26 09:50:16 CDT 2005

Another approach would be to use the Relations collection. It allows to
"link" DataTables and to "navigate" between them... Really depends what you
want to do...


Patrice

--

"Jim Heavey" <JimHeavey@discussions.microsoft.com> a écrit dans le message
de news:F425CACD-FA34-43BD-AB95-4763A73DB75C@microsoft.com...
> I have data from two different databases which I want to join together.
If
> I create one Datatable with the results of one query and another Datatable
> with the results of the second query, can I somehow join the 2 Datatables
to
> produce a result which will look like I had executed a single query to
return
> a single datatable?



RE: Data Table Joins by EltonW

EltonW
Thu May 26 12:47:07 CDT 2005

Hi Jim,

Are two databases in same machine, or they are complete different databases,
e.g. one in sql-server, another in Oracle?

Elton Wang

"Jim Heavey" wrote:

> I have data from two different databases which I want to join together. If
> I create one Datatable with the results of one query and another Datatable
> with the results of the second query, can I somehow join the 2 Datatables to
> produce a result which will look like I had executed a single query to return
> a single datatable?

RE: Data Table Joins by JimHeavey

JimHeavey
Thu May 26 14:25:02 CDT 2005

They are the same "type", that being Oracle, but they have different
connections to get to them.

"Elton W" wrote:

> Hi Jim,
>
> Are two databases in same machine, or they are complete different databases,
> e.g. one in sql-server, another in Oracle?
>
> Elton Wang
>
> "Jim Heavey" wrote:
>
> > I have data from two different databases which I want to join together. If
> > I create one Datatable with the results of one query and another Datatable
> > with the results of the second query, can I somehow join the 2 Datatables to
> > produce a result which will look like I had executed a single query to return
> > a single datatable?

RE: Data Table Joins by DaveVB

DaveVB
Thu May 26 15:07:35 CDT 2005

Jim,
Assuming you are just trying to combine records from two tables from
separate DBs, if you create a dataset for each source and then use the
datset.merge function, it will combine the data from the two tables.

Hope this helps,
Dave

"Jim Heavey" wrote:

> They are the same "type", that being Oracle, but they have different
> connections to get to them.
>
> "Elton W" wrote:
>
> > Hi Jim,
> >
> > Are two databases in same machine, or they are complete different databases,
> > e.g. one in sql-server, another in Oracle?
> >
> > Elton Wang
> >
> > "Jim Heavey" wrote:
> >
> > > I have data from two different databases which I want to join together. If
> > > I create one Datatable with the results of one query and another Datatable
> > > with the results of the second query, can I somehow join the 2 Datatables to
> > > produce a result which will look like I had executed a single query to return
> > > a single datatable?

RE: Data Table Joins by EltonW

EltonW
Thu May 26 20:01:03 CDT 2005

Although Iâ??m not sure in Oracle, in sql-server, itâ??s possible to query cross
different databases:

SELECT T1.*, T2.* FROM database1.dbo.Table1 T1 JOIN database1.dbo.Table2 T2
ON T1.ID = T2.ID WHERE CONDITION


HTH

Elton Wang




"Jim Heavey" wrote:

> They are the same "type", that being Oracle, but they have different
> connections to get to them.
>
> "Elton W" wrote:
>
> > Hi Jim,
> >
> > Are two databases in same machine, or they are complete different databases,
> > e.g. one in sql-server, another in Oracle?
> >
> > Elton Wang
> >
> > "Jim Heavey" wrote:
> >
> > > I have data from two different databases which I want to join together. If
> > > I create one Datatable with the results of one query and another Datatable
> > > with the results of the second query, can I somehow join the 2 Datatables to
> > > produce a result which will look like I had executed a single query to return
> > > a single datatable?