The things I learnt while I migrated from classic asp to asp.net is given here for my reference as well as for new beginners.

ASP.NET-CSHARP-XML-AS-DATABASE

Working ASP.NET code

for using XML file as a Database

XML Code for emp.xml file
<?xml version="1.0" encoding="iso-8859-1"?>
<emp>
<record>
<name>Raja</name>
<age>25</age>
</record>
<record>
<name>Peter</name>
<age>23</age>
</record>
</emp>



ASP.NET Code for

simpleRepeater.aspx
<%@ Import Namespace="System.Data" %>
<script runat="server">
sub Page_Load
if Not Page.IsPostBack then
dim empDataSet=New DataSet
empDataSet.ReadXml(MapPath("emp.xml"))
empRepeater.DataSource=empDataSet
empRepeater.DataBind()
end if
end sub
</script>
<html>
<body>

<form runat="server">
<asp:Repeater id="empRepeater" runat="server">

<HeaderTemplate>
<table border="1" >
<tr>
<th align="left">Name</th>
<th align="left">Age</th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr>
<td><%#Container.DataItem("name")%> </td>
<td><%#Container.DataItem("age")%> </td>
</tr>
</ItemTemplate>

Just copy the above two files in proper location and open the file simpleRepeater.aspx. You will get the result like this :

Name Age
Raja 25
Peter 23

Here XML file acts just like a Database

Thanks for Your Visit

Google Search
Disclaimer and Copy Right