E
Elmo Watson
I'm just trying to figure out opening an xml file, adding a row and saving
it, but for some reason it's not working, so I hope you can help me out
here -
The code I've got is:
Dim Myds As New DataSet
Myds.ReadXml(GetSPath())
Myds.AcceptChanges()
Dim NewBook As DataRow
NewBook = Myds.Tables("books").NewRow() '<-------- here's the problem - -
error: Object reference not set to an instance of an object.
NewBook ("Title") = sTitle
NewBook ("Author") = sAuthor
NewBook ("ISBN") = sISBN
Myds.Tables("books").Rows.Add(NewBook )
Myds.WriteXml(GetSPath(), XmlWriteMode.IgnoreSchema)
I'm calling the table 'books' because of the xml file root node:
<?xml version="1.0" encoding="ISO-8859-1"?>
<books>
</books>
What am I doing wrong
it, but for some reason it's not working, so I hope you can help me out
here -
The code I've got is:
Dim Myds As New DataSet
Myds.ReadXml(GetSPath())
Myds.AcceptChanges()
Dim NewBook As DataRow
NewBook = Myds.Tables("books").NewRow() '<-------- here's the problem - -
error: Object reference not set to an instance of an object.
NewBook ("Title") = sTitle
NewBook ("Author") = sAuthor
NewBook ("ISBN") = sISBN
Myds.Tables("books").Rows.Add(NewBook )
Myds.WriteXml(GetSPath(), XmlWriteMode.IgnoreSchema)
I'm calling the table 'books' because of the xml file root node:
<?xml version="1.0" encoding="ISO-8859-1"?>
<books>
</books>
What am I doing wrong