Skip to content

Update XML File using DataSet

oc A

Asked Jul 18, 2008, 10:19 PM EDT1 answer
Share
LinkedInX

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.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
    use XmlDataDocument object then overload it by your dataset in its constructor
    then use XmlDataDocuement.Save(@"path");
    0