Cannot add a nested relation or element column to a table containing a SimpleContent column. in c #

DataSet ds = new DataSet();
System.IO.StringReader xmlSR = new System.IO.StringReader(xml);
ds.ReadXml(xmlSR);

DataTable dtIItems = new DataTable();
DataTable dtHotelInformation = new DataTable();
dtIItems = ds.Tables[30];
dtHotelInformation = ds.Tables[51];
DataColumn DCHotelImage = dtHotelInformation.Columns[2];
var Items = dtIItems;
Items.Columns.Add(DCHotelImage.ColumnName,DRHotelImage.DataType);

When I add a column from another DataTable, this runtime error message returns

You cannot add a nested relation or element column to the table containing the SimpleContent column.

Note . I can’t change anything in xml files because it is provided by third-party

+4
source share

All Articles