<%@ Page Language="c#" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<html>
<title>Converting XML to DataSet and Vice versa. </title>
<head>
<script language="c#" runat="server">
void Page_Load(Object sender,EventArgs e) {
try
{
DataSet Ds = new DataSet();
Ds.ReadXml(Server.MapPath("Data.XML"));
Ds.AcceptChanges();
Ds.Tables[0].Rows[0]["LastModified"] = DateTime.Now.ToString();
DataSet dsChanges = new DataSet();
dsChanges = Ds.GetChanges();
dsChanges.WriteXml(Server.MapPath("") + "\\DataWrite.xml");
}
catch (Exception Ex)
{
LblValue.Text = Ex.Message;
}
}
</script>
</head>
<body>
<form id="frm" runat="server">
<asp:Label id="LblValue" runat="server" />
<hr>
<a href="Data.xml">Data.xml</a> | <a href="DataWrite.xml">DataWrite.xml</a>
</form>
</body>
|