We help IT Professionals succeed at work.

VB.NET - Can I Execute A SELECT Statement On An XML File?

feesu
feesu asked
on
Medium Priority
533 Views
Last Modified: 2013-11-26
Hi Experts,
Is it possible to execute an SQL Select statement on an XML file?
I have an XML file that holds some data and need to read them in a way similar to the GROUP BY.
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
you could load the XML into a dataset: dataset.readxml()
http://www.codeguru.com/vb/gen/vb_database/adonet/article.php/c5153/

from there, you can use the datatable's SELECT property...

Author

Commented:
But from there I cannot do GROUP BY!
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:

Author

Commented:
angelIII,
This sample shows the function that uses the class, but doesn't show how you select the fields that you want to group by!

Or maybe I didn't notice it, please help me?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
did you notice the file to be downloaded, right part of the page:
Download Files
DataSetHelper.zip

Author

Commented:
I want to implement the below SQL statement, which I am currently not able to.
I am not able to use that class. I tried createGroupBy function and the others but seems I'm not able to return my result set. It always gives an Object Reference Not Set error.
SELECT row, stockId, stock, price, sum(bidCnt) AS bidCnt, sum(bidQty) AS bidQty, sum(askCnt) AS askCnt, sum(askQty) AS askQty
FROM OrderBook
GROUP BY row,stockId,stock,price
ORDER BY stockId ASC, price DESC

Open in new window

Author

Commented:
I downloaded the file, it's only one class file. With no sample code on how to use it! You may try and tell me if I missed something.

Author

Commented:
angelIII,
You seem too busy to reply.
I've been trying so hard on that. It doesn't seem to work as expected. But I would use a part of it.

Thanks for the time you spent looking for that code!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.