Embed
Email

Computer Notes

Document Sample
Computer Notes
Tags
Stats
views:
52
posted:
8/19/2009
language:
English
pages:
4
Questions and answers in this FAQ have been collected from newsgroup posts, various mailing lists and the employees of Syncfusion. 12. XML 12.1 How to write the data from database into an XML file? 12.2 12.3 12.4 12.5 12.6 How to read data from an XML file and display it in a DataGrid? How to read data from the XML file using FileStream and display it in a DataGrid? How to save an xml-string into an Xml document? How to use the tag? How to display the Attribute values in an XML Document in a DataGrid? FAQ Home



12.1 How to write the data from database into an XML file? VB.NET



'Fill the DataSet ds.WriteXml(Server.MapPath ("products.xml" ) )



C#



//Fill the DataSet ds.WriteXml(Server.MapPath ("products.xml" ) );



Note : Make sure you have write and modify rights.



12.2 How to read data from an XML file and display it in a DataGrid? VB.NET



dim ds as new DataSet() ds.ReadXml (Server.MapPath ("products.xml")) DataGrid1.DataSource =ds DataGrid1.DataBind()



C#



DataSet ds= new DataSet (); ds.ReadXml (Server.MapPath ("products.xml")); DataGrid1.DataSource =ds; DataGrid1.DataBind();



12.3 How to read data from the XML file using FileStream and display it in a DataGrid? Use namespace System.IO VB.NET



dim ds as new DataSet() dim fs as FileStream = new FileStream (Server.MapPath ("products.xml"),FileMode.Open , FileAccess.Read ) ds.ReadXml (fs) DataGrid1.DataSource = ds DataGrid1.DataBind ()



C#



DataSet ds= new DataSet (); FileStream fs = new FileStream (Server.MapPath ("products.xml"),FileMode.Open , FileAccess.Read ); ds.ReadXml (fs); DataGrid1.DataSource = ds; DataGrid1.DataBind ();



12.4 How to save an xml-string into an Xml document? VB.NET



Dim xmlText As String = "Node1Node2" Dim xmlDoc As New XmlDocument xmlDoc.LoadXml(xmlText) Dim writer As XmlTextWriter = New XmlTextWriter(Server.MapPath("data.xml"), Nothing) writer.Formatting = Formatting.Indented xmlDoc.Save(writer)



C#



string xmlText = "Node1Node2"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlText); XmlTextWriter writer = new XmlTextWriter(Server.MapPath("data.xml"),null); writer.Formatting = Formatting.Indented; xmlDoc.Save(writer);



12.5 How to use the tag?







12.6 How to display the Attribute values in an XML Document in a DataGrid? products.xml



2 Chang 1 1 24 - 12 oz bottles 3 Aniseed Syrup 1 2 12 - 550 ml bottles



Use Namespace System.Xml VB.NET











dim xmldoc as XmlDocument = new XmlDocument() xmldoc.Load(Server.MapPath("products.xml")) dim xmlnodes as XmlNodeList = xmldoc.SelectNodes("NewDataSet/Product/ProductID") DataGrid1.DataSource = xmlnodes DataGrid1.DataBind ()



C#







XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(Server.MapPath("products.xml")); XmlNodeList xmlnodes = xmldoc.SelectNodes("NewDataSet/Product/ProductID"); DataGrid1.DataSource = xmlnodes; DataGrid1.DataBind ();



© 2001-2008 Copyright Syncfusion Inc. All rights reserved. | Privacy Policy | Contact | Sitemap




About
I am Computer Professional, did my MCA and seeking a Job in Software industry. I love computers
Other docs by aswath ramacha...
Computer Notes
Views: 39  |  Downloads: 1
JAVA
Views: 7  |  Downloads: 0
Interview questions
Views: 5  |  Downloads: 0
Interview questions
Views: 12  |  Downloads: 1
Wireless Networking
Views: 94  |  Downloads: 2
Computer Notes
Views: 15  |  Downloads: 0
Computer Notes
Views: 111  |  Downloads: 0
Wireless Networking
Views: 2  |  Downloads: 0
Interview questions
Views: 5  |  Downloads: 0
Interview questions
Views: 101  |  Downloads: 3
Related docs
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!