EDN Admin
Well-known member
Hi all ,
i want to save different user name and password in single XML file .
for this i wrote this code on save button :-
<span style="white-spacere string filename = "E:\firstXML.xml";<br/>
XmlDocument xmlDoc = new XmlDocument();<br/>
XmlTextWriter xmlWriter = new XmlTextWriter(filename, System.Text.Encoding.UTF8);<br/>
xmlWriter.Formatting = Formatting.Indented;<br/>
xmlWriter.WriteProcessingInstruction("xml", "version=1.0 encoding=UTF-8");<br/>
xmlWriter.WriteStartElement("Credential");<br/>
xmlWriter.Close();<br/>
xmlDoc.Load(filename);<br/>
XmlNode root = xmlDoc.DocumentElement;<br/>
XmlElement childNode1 = xmlDoc.CreateElement("UserName");<br/>
XmlElement childNode2 = xmlDoc.CreateElement("Password");
<span style="white-spacere root.AppendChild(childNode1);<br/>
childNode1.InnerText = tbName.Text;
<span style="white-spacere root.AppendChild(childNode2);<br/>
childNode2.InnerText = tbPassword.Text;
<span style="white-spacere xmlDoc.Save(filename);
USING THIS XML IS CREATING BUT NEXT TIME IF I AM INSERTING DIFFERENT USER NAME AND PASSWORD IT IS REPLACING MY PREVIOUS DATA. HOW TO ADD ALL USER NAME AND PASSWORD INTO SINGLE XML FILE PLEASE HELP.. <hr class="sig sumitk
View the full article
i want to save different user name and password in single XML file .
for this i wrote this code on save button :-
<span style="white-spacere string filename = "E:\firstXML.xml";<br/>
XmlDocument xmlDoc = new XmlDocument();<br/>
XmlTextWriter xmlWriter = new XmlTextWriter(filename, System.Text.Encoding.UTF8);<br/>
xmlWriter.Formatting = Formatting.Indented;<br/>
xmlWriter.WriteProcessingInstruction("xml", "version=1.0 encoding=UTF-8");<br/>
xmlWriter.WriteStartElement("Credential");<br/>
xmlWriter.Close();<br/>
xmlDoc.Load(filename);<br/>
XmlNode root = xmlDoc.DocumentElement;<br/>
XmlElement childNode1 = xmlDoc.CreateElement("UserName");<br/>
XmlElement childNode2 = xmlDoc.CreateElement("Password");
<span style="white-spacere root.AppendChild(childNode1);<br/>
childNode1.InnerText = tbName.Text;
<span style="white-spacere root.AppendChild(childNode2);<br/>
childNode2.InnerText = tbPassword.Text;
<span style="white-spacere xmlDoc.Save(filename);
USING THIS XML IS CREATING BUT NEXT TIME IF I AM INSERTING DIFFERENT USER NAME AND PASSWORD IT IS REPLACING MY PREVIOUS DATA. HOW TO ADD ALL USER NAME AND PASSWORD INTO SINGLE XML FILE PLEASE HELP.. <hr class="sig sumitk
View the full article