|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Query against two DataTablesI 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. 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). -- Show quoteMiha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Roy" <R**@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. 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 Show quote "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" <R**@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. > > |
|||||||||||||||||||||||