Dataset Behaviour with XMl Schema

Today I tried loading an XML Schema into a dataset using ReadXMLSchema() method. I noticed that If the first element in the schema doesn't have any columns, the dataset will not create a table for it and the dataset name will be the name of the first element. In reverse to this, if the first element is having columns, the dataset will treat it as a table and the dataset name will be given as "NewDataset". In a situation , when you are manipulating dataset tables using C# code, you need to take care of this special case. One of ways to compare the dataset.DataSetName property to the dataset.Tables[0].TableName and you can identify if the first table is treated as Dataset or not.   ~Sandeep

Comments (0)

Skip to main content