A field that contains only NULL values is not copied into a new DataSet when you use the GetXml method to copy data from one DataSet to another DataSet (317961)
The information in this article applies to:
- Microsoft ADO.NET (included with the .NET Framework)
- Microsoft ADO.Net 2.0
This article was previously published under Q317961 SYMPTOMS
When you use the GetXml method to copy data from one DataSet object to another, if any of the fields in the original DataSet contain only NULL (DbNull) values, these fields are not copied into the new DataSet.
CAUSE
This problem occurs because the DataSet.GetXml method does not include schema information. If you use another DataSet to read this output, the DataSet depends on the InferSchema value to recover schema information. However, because all of the values in the column are NULL, the column is absent from the GetXml output, and InferSchema cannot recover this column information. For additional information about why attributes are not generated for fields that contain a NULL value, click the article number below
to view the article in the Microsoft Knowledge Base:
296393 PRB: Attributes Are Not Generated for Fields That Contain a NULL Value When ADO Recordset Is Persisted in XML
RESOLUTION
To resolve this problem, use the Copy method instead of the GetXml method. Microsoft recommends that you use the Copy method because the Copy method does not convert the DataSet to Extensible Markup Language (XML) and back.
STATUSThis behavior is by design.REFERENCESFor additional information about how to write and how to read XML data from a DataSet, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
308064 HOW TO: Persist an ADO.NET DataSet as XML by Using Visual Basic .NET
309702 HOW TO: Read XML Data into a DataSet by Using Visual Basic .NET
For additional information about ADO.NET, click the article number below
to view the article in the Microsoft Knowledge Base:
313590 INFO: Roadmap for ADO.NET
Modification Type: | Minor | Last Reviewed: | 3/9/2006 |
---|
Keywords: | kbDataAdapter kbManaged kbprb kbSystemData KB317961 kbAudDeveloper kbAudITPRO |
---|
|