Converting XML to DataSet and Vice versa (VB) : DataSet « ADO.net Database « ASP.Net






Converting XML to DataSet and Vice versa (VB)

<%@ Page Language="vb" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<html>
  <head>
    <title>Converting XML to DataSet and Vice versa.</title>
    <script language="vb" runat="server">
   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 
        Try
            Dim Ds As New DataSet

            Ds.ReadXml(Server.MapPath("Data.XML"))
            Ds.AcceptChanges()
            Ds.Tables(0).Rows(0).Item("LastModified") = DateTime.Now.ToString()
            Dim dsChanges As DataSet
            dsChanges = Ds.GetChanges()
            dsChanges.WriteXml(Server.MapPath("") & "\DataWrite.xml")
        Catch ex As Exception
            lblvalue.text = ex.Message
        End Try
    End Sub
    </script>
  </head>
  <body>
    <form id="frm" runat="server">
      <asp:Label id="LblValue" runat="server" />
      <hr>
      <a href="DSRead.xml">DSRead.xml</a> | <a href="DSWrite.xml">DSWrite.xml</a>
    </form>
  </body>

 








Related examples in the same category

1.Loop through data in Sql Server by DataSet
2.Loop through DataSet
3.Get query result from DataSet
4.Load Table from DataSet
5.Build a DataSet
6.Create DataSet pragmatically
7.Build a DataSet with relationship
8.Output the content of a DataSet as XML
9.Finding a Particular Row in a DataSet
10.Converting XML to DataSet and Vice versa
11.Programmatically creating a DataSet object
12.DataSet Serialization and Deserialization using Binary Format