PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Query against two DataTables

Reply

Query against two DataTables

 
Thread Tools Rate Thread
Old 06-04-2006, 09:15 PM   #1
=?Utf-8?B?Um95?=
Guest
 
Posts: n/a
Default Query against two DataTables


I have two DataTables with a foreign key between them and I can query each
DataTable and combine data.
Is there an easy way for me to make a query against the two, just like the
join query in SQL Server against two tables?
Or what is the best way to do it? I check on DataView and DataSet class and
won't let me do it.
  Reply With Quote
Old 07-04-2006, 07:50 AM   #2
Miha Markic [MVP C#]
Guest
 
Posts: n/a
Default Re: Query against two DataTables

Hi Roy,

The easiest way is to do it on the server (as you mentioned - with joins) as
there is no join support in ado.net (you can still do it manually).

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Roy" <Roy@discussions.microsoft.com> wrote in message
news:05528EC4-E3A7-4ED9-994E-84E59DEA2432@microsoft.com...
>I have two DataTables with a foreign key between them and I can query each
> DataTable and combine data.
> Is there an easy way for me to make a query against the two, just like the
> join query in SQL Server against two tables?
> Or what is the best way to do it? I check on DataView and DataSet class
> and
> won't let me do it.



  Reply With Quote
Old 09-04-2006, 02:31 PM   #3
Adrian Moore
Guest
 
Posts: n/a
Default Re: Query against two DataTables

Roy,

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.

It might be overkill for what you want, but it might be a useful tool too.

Adrian Moore
http://www.queryadataset.com


"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OcKVIEhWGHA.2080@TK2MSFTNGP05.phx.gbl...
> Hi Roy,
>
> The easiest way is to do it on the server (as you mentioned - with joins)
> as there is no join support in ado.net (you can still do it manually).
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "Roy" <Roy@discussions.microsoft.com> wrote in message
> news:05528EC4-E3A7-4ED9-994E-84E59DEA2432@microsoft.com...
>>I have two DataTables with a foreign key between them and I can query each
>> DataTable and combine data.
>> Is there an easy way for me to make a query against the two, just like
>> the
>> join query in SQL Server against two tables?
>> Or what is the best way to do it? I check on DataView and DataSet class
>> and
>> won't let me do it.

>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off