Update XML File using DataSet

  • 9 years ago

    Hai all ,

    i am doing a VB.NET Windows Application .. In that i am populating the datagrid with the contents of an XML  File (using DataSet). In the datagrid if i make any changes , it should be updated to the XML File . How can i do this ? I did the coding like this .

    Dim DS as new DataSet 

    Dim
    dsl As New DataSetDim onm, oc, od As Stream

    FileNam = "OrgXML.xml"

    DS.ReadXml(FileNam, XmlReadMode.DiffGram)

    dsl = DS.GetChanges(DataRowState.Modified)

    dsl.WriteXml(FileNam, XmlWriteMode.DiffGram)

    But this code is not working .. I am getting the error that "Object Reference not set to instance of an object" How can i resolve this ? Any body plz help . its urgent.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan