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