I have added a .xml file to application resources.
Now I want to access that xml file and fill dataset using that xml file in c#.net
Can anyone help that how can i do this in C#.net
I have added a .xml file to application resources.
Now I want to access that xml file and fill dataset using that xml file in c#.net
Can anyone help that how can i do this in C#.net
Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Namespace.XMLFileName.xml");
XmlDocument xdoc = new XmlDocument();
StreamReader reader = new StreamReader(s);
xdoc.LoadXml(reader.ReadToEnd());
reader.Close();
You'll have to put your own name in there
thanx Momerath..
But I am getting null value in Stream S
I got the perfect Answer for it.
Here it is the code
DataSet ds = new DataSet();
XDocument doc = XDocument.Parse(AccessToXml.Properties.Resources.Name);
ds.ReadXml(doc.CreateReader());
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.