471,310 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

where clausule in xml file

hi,
i know how to save table content (example: select * from products) to a xml
file

the code below opens the xml file read all records.
i would like to know how i can filter the records like in a query?
can i do something like:
select * from PRODUCTS.XML where id >100 or something????

DataSet ds = new DataSet();
string myXMLfile = @"products.xml";
System.IO.FileStream fsReadXml = new System.IO.FileStream
(myXMLfile, System.IO.FileMode.Open);
try
{
ds.ReadXml(fsReadXml);
XmlReader xrdr = testCommand.ExecuteXmlReader();
xrdr.Read();
Console.WriteLine(xrdr.ReadOuterXml());
foreach (DataRow row in ds.Tables[0].Rows)
{
MessageBox.Show(row["DESCRIPTION"].ToString());
}
......
Sep 15 '08 #1
1 991
On Sep 15, 11:26*am, "Smart Software" <i...@smart-software.orgwrote:
i know how to save table content (example: select * from products) to a xml
file

the code below opens the xml file read all records.
i would like to know how i can filter the records like in a query?
can i do something like:
select * from PRODUCTS.XML where id >100 or something????
If you're using .NET 3.5, the best way of working would be to either
use a typed dataset and LINQ to DataSet, or LINQ to XML directly.
Either way, you can write your queries in C# 3 with a query
expression. If you're not using .NET 3.5 life becomes a bit harder,
unfortunately. You can probably do it without *too* much effort, but I
wouldn't like to say how off the top of my head. (I don't use datasets
much.)

Jon
Sep 15 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Robert Misiorowski | last post: by
8 posts views Thread by Micha³ Wo¼niak | last post: by
10 posts views Thread by vwd2005eeb | last post: by
1 post views Thread by rdemyan via AccessMonster.com | last post: by
10 posts views Thread by Paul Cheetham | last post: by
15 posts views Thread by amit.man | last post: by
6 posts views Thread by littlelisper | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.