C
Chris Kennedy
I am having big problem manipulating XML in a dataset. I am reading in a
schema based on the following XML document. The minute I try to e.g. create
a new row I get 'Object reference not set to an instance of an object' error
<?xml version="1.0" encoding="utf-8"?>
<DocumentElement xmlns="http://tempuri.org/dseditted2.xsd">
<TableInfo>
<FieldName>column value</FieldName>
<ControlType>column value</ControlType>
<IsNull>column value</IsNull>
<MaxLength>column value</MaxLength>
</TableInfo>
</DocumentElement>
editteddataset = New DataSet()
editteddataset.ReadXmlSchema("C:\Inetpub\wwwroot\xmlxconfig\dseditted2.xsd")
Dim dsItem As DataRow
Dim dsTable As DataTable
dsTable = editteddataset.Tables("TABLEINFO")
dsItem = editteddataset.Tables("TABLEINFO").NewRow
Dim getcontroltype As DropDownList
getcontroltype = CType(e.Item.FindControl("controltype"), DropDownList)
THIS IS THE LINE OF CODE WHICH GENERATES THE ERROR
dsItem("CONTROLTYPE") = getcontroltype.DataTextField
What am I not understanding about XML, As I am fine when it is pulled from a
database.
schema based on the following XML document. The minute I try to e.g. create
a new row I get 'Object reference not set to an instance of an object' error
<?xml version="1.0" encoding="utf-8"?>
<DocumentElement xmlns="http://tempuri.org/dseditted2.xsd">
<TableInfo>
<FieldName>column value</FieldName>
<ControlType>column value</ControlType>
<IsNull>column value</IsNull>
<MaxLength>column value</MaxLength>
</TableInfo>
</DocumentElement>
editteddataset = New DataSet()
editteddataset.ReadXmlSchema("C:\Inetpub\wwwroot\xmlxconfig\dseditted2.xsd")
Dim dsItem As DataRow
Dim dsTable As DataTable
dsTable = editteddataset.Tables("TABLEINFO")
dsItem = editteddataset.Tables("TABLEINFO").NewRow
Dim getcontroltype As DropDownList
getcontroltype = CType(e.Item.FindControl("controltype"), DropDownList)
THIS IS THE LINE OF CODE WHICH GENERATES THE ERROR
dsItem("CONTROLTYPE") = getcontroltype.DataTextField
What am I not understanding about XML, As I am fine when it is pulled from a
database.