Reputation:
At present I’m developing a registration form in which, when we click on the save button. It will get save in a xml file. The details in the xml file should be displayed in the datagrid in separate window form. There are also three buttons. Edit, new and delete. On clicking on edit button, the selected rows detail in gridview should display in the registration form. I don’t know how to do this.
By selecting a row, when we click on delete button , it should delete that particular record from the xml file. This also I’m not getting……….. please help me………………………………..
Regards,
Manikandan.S
Upvotes: 1
Views: 326
Reputation: 3219
This is readymade example By Zubair Ahmed and Scott Mitchell. It displays and explains Editing of XML file with the use of Grid. I think this is what you need.
https://web.archive.org/web/20210513223010/http://aspnet.4guysfromrolla.com/articles/112603-1.aspx
Upvotes: 6
Reputation: 24132
I guess this is what you want to do at the end. XML - Insert/Update/Delete/Query
Hope this helps! Please let me know!
Upvotes: 0
Reputation: 5320
Why don't you use a serializeable object then you can work with an object in your form and whenever you want you can serialize it to a file or into a db field. There's a utility called XSD.exe that lets you build a serializeable object model from a xml.
Upvotes: 2
Reputation: 94645
Choose DataSet class.
SUMMARY:
A DataSet can read and write data and schema as XML documents. The data and schema can then be transported across HTTP and used by any application, on any platform that is XML-enabled. You can save the schema as an XML schema with the WriteXmlSchema method, and both schema and data can be saved using the WriteXml method. To read an XML document that includes both schema and data, use the ReadXml method.
In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to:
- Build and fill each DataTable in a DataSet with data from a data source using a DataAdapter.
- Change the data in individual DataTable objects by adding, updating, or deleting DataRow objects.
- Invoke the GetChanges method to create a second DataSet that features only the changes to the data.
- Call the Update method of the DataAdapter, passing the second DataSet as an argument.
- Invoke the Merge method to merge the changes from the second DataSet into the first.
- Invoke the AcceptChanges on the DataSet. Alternatively, invoke
RejectChanges to cancel the changes.
Upvotes: 2