how to Create an aplication which will store data in XML instead of Database

Dears,

Can you peoples write codes, i like that you people past complete code

thanks




Answer this question

how to Create an aplication which will store data in XML instead of Database

  • totte500

    hi,

    the easiest way to do that is to add a dataset to your solution and to design it in design viewer add the tables that you need , columns to the table relations between tables ... etc like you design the database tables

    add instance of this dataset to your form

    in your form load event handlers use mydataset.readxml(@"filepath.xml")

    in your save button event handler use mydataset.writexml(@"filepath.xml")

    but remember to add using System.Xml ; name spaces, also first time you try to read it could give you nullreference exception (i'm not sure )because the file doesn't exist so (if that happend)let your datasetwrite it manualy first time

    hope this helps



  • Ehsan F. Hayati

    Hi jone,

    if you write complete code then i will be very happy.

    thanks



  • Bill Raleigh

    Hi Jehan,

    Make use of the instance methods, ReadXml and WriteXml of Dataset class.



  • how to Create an aplication which will store data in XML instead of Database