View Single Post
  #1 (permalink)  
Old August 20th, 2009, 12:59 PM
shailesh_kumar shailesh_kumar is offline
Authorized User
Join Date: Feb 2007
Location: Delhi, Delhi, India.
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default Overwrite the User Input in XML file

I'm learning to code in C#. I'm writing the code which gets the UserInput from Command line and saves it in the XML file. I'm using XML serialization and Deserialization to get the User input(for e.g. BankAccountNumber,Type,Balance) in XML file. My code overwrites the last user input and doesn't add/increment the last user input as next entry. I guess, I'm missing some enhancement in my code to save/increment each user input in XML file. I would appreciate, If someone could help me to resolve this issue.

Thanks for Your Help !

Thanks gbianchi and samjudson for your attention and Help ! Please let me know, If you need more information.


Following is the small section of my Code :-

AccNum.accNum = number;
AccNum.accTyp = acc_typ;
AccNum.accBal = acc_balance;

// Serialize - Account(Number,Type,Balance)
// Account Number Serialization
StreamWriter acnw = newStreamWriter(@"c:\Acclist.xml");
XmlSerializer acns = newXmlSerializer(typeof(AccountBook));
acns.Serialize(acnw, AccNum);

// DeSerialize - Account(Number,Type,Balance)
// Account Number Deserialization
AccountBook acc_Number;
TextReader acnd = newStreamReader(@"c:\Acclist.xml");
acc_Number = (

return created;