SqlCommand cmd = new SqlCommand("Select top 10 * from TblAppointment", con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
XmlDocument doc = new XmlDocument();
foreach (var XML in ds.Tables[0].AsEnumerable())
{
doc.LoadXml(XML.Field<string>("AppointmentTransXml"));
doc.Save(Server.MapPath("XML") + "//" + XML.Field<string>("Patientname") + ".xml");
}
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
XmlDocument doc = new XmlDocument();
foreach (var XML in ds.Tables[0].AsEnumerable())
{
doc.LoadXml(XML.Field<string>("AppointmentTransXml"));
doc.Save(Server.MapPath("XML") + "//" + XML.Field<string>("Patientname") + ".xml");
}