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).

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
        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.
[no name] 29-Sep-14 21:06pm

1 solution

Try linq to xml?
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[^]
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