Mr bijeesh i just changed some codes and formated as this
public string favXml = "E:/My Webs/NIBS Website/www.microsquirrel.com/www.microsquirrel.com/News/news.xml";
private void WriteXmlMethod()
{
string constring = ConfigurationManager.ConnectionStrings["ConnectionStringNews"].ToString();
SqlConnection con = new SqlConnection(constring);
con.Open();
string query = "select * from tbl_newsBee";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataReader dr = cmd.ExecuteReader();
XmlDocument myXml = new XmlDocument();
XmlElement el = myXml.CreateElement("news");
while(dr.read())
{
el.SetAttribute("link", dr[2].ToString());
el.SetAttribute("des", dr[1].ToString());
el.InnerText = dr[3].ToString();
if (!File.Exists(favXml))
{
XmlElement root = myXml.CreateElement("newses");
myXml.AppendChild(root);
root.AppendChild(el);
LabelMessageDel.Text = "Item Created";
}
else
{
myXml.RemoveAll();
XmlElement root = myXml.CreateElement("newses");
myXml.AppendChild(root);
root.AppendChild(el);
LabelMessageDel.Text = "Item Created";
}
}
con.Close();
myXml.Save(favXml);
}
Here i only get one data written in xml doc, where i have more than one data in my database. how to get write all data at once
How it happen,and one more thing i'm using asp.net 2.0 so LINQ doesn't support.
Thank you.