Click here to Skip to main content
15,939,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)

I have a small project that is not able to connect to a database so I
have the data necessary for the project to run, saved into an XML file
in the root directory of the project/solution in VB Net. I am able to
load the XML data into a temporary table at runtime but am unable to locate a
way to query the temp table via code. An simple example of a query to
a temp table within a project would be nice.

The Table is set up as follows...

1) AutoID *Key
2) Name as string
3) Filepath as string
4) Count as integer
5) Type as string

The following places the data into a table on the page but I
am looking for a way to query/filter this before hand. I would
like to Oder it by Name (A-Z).

VB
Dim DS As DataSet
        DS = New DataSet()

        DS.ReadXml(appPath + "\data.xml")
        Dim i As Integer
        For i = 0 To DS.Tables(0).Rows.Count - 1
            Console.WriteLine(DS.Tables(0).Rows(i).Item(1))
        Next
        DataGrid1.DataSource = DS


I know that they is probably a way to do this using the dataSource
I created. But I would also like a plain example of how to perform
a query via code to "Select * From TableA where Name = 'Mike'"

Thanks for any help.
Posted
Comments
[no name] 29-Sep-14 21:06pm    
http://msdn.microsoft.com/en-us/library/bb552415(v=vs.110).aspx

1 solution

Try linq to xml?
VB
Dim partNos = _
    From item In purchaseOrder...<Item> _
    Where (item.<Quantity>.Value * _
           item.<USPrice>.Value) > 100 _
    Order By item.<PartNumber>.Value _
    Select item

I copyed this code from MSDN.For further knowledge.Refer to http://msdn.microsoft.com/en-us/library/bb387061.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900