|
Subject:
|
Using SQL together with DataSet?
|
|
Posted By:
|
jacob
|
Post Date:
|
1/11/2006 11:48:52 AM
|
Can it be true that it is not possible to use SQL queries together with a DataSet? I find it hard to believe.
If it is not possible, is there a way around it? E.g. transforming the data to another type and then perform SQL joins on the transformed data?
Thanks, Jacob.
|
|
Reply By:
|
planoie
|
Reply Date:
|
1/11/2006 12:01:10 PM
|
You can populate a dataset from a SQL query. You could populate several related tables in a dataset. Then you can establish relationships between the tables that represent foreign key relationships in the database. Then you can use SQL style elements to define a table's filter and sort. Also, you can use the relationships between the tables to retrieve child rows. But I don't think it's possible to perform pure SQL style queries as a dataset as if it were a database.
-Peter
|
|
Reply By:
|
jacob
|
Reply Date:
|
1/11/2006 12:11:35 PM
|
Alright, thanks.
I have two sources for constructing the DataSet; i.e. a database and possibly altered data in a UI, and therefore I cannot use the SQL approach on the database directly (defining the SQL directly). I have to do join queries on the DataSet, and hoped for work-around, but I see that no shortcuts.
What about XPath? It must be possible to get an XML representation of the DataSet, and then do XPath queries. Can XPath define constructions such as join?
Jacob.
|
|
Reply By:
|
planoie
|
Reply Date:
|
1/11/2006 12:35:16 PM
|
The dataset has a GetXml() method which will return the internal XML representation of the whole dataset. You could suck that into an XmlDocument object and do any XPath queries against it.
I don't often work with complex DataSets but I suspect there must be a way of doing what you need.
-Peter
|
|
Reply By:
|
jacob
|
Reply Date:
|
1/11/2006 3:16:44 PM
|
Thanks Peter, I think I will try that approach. BR, Jacob.
|
|
Reply By:
|
robzyc
|
Reply Date:
|
8/12/2008 2:25:51 AM
|
WTF? Why bring this thread up from the ashes with such a lame line? Mods BURNINATE! 
Rob http://cantgrokwontgrok.blogspot.com
|