Creating XML using DataSet.WriteXml, including columns containing NULL
-
Hi all, I am trying to create a XML using DataSet.WriteXml. The XML was created, but its not creating any node for NULLs. I also tried by query "SELECT (SELECT * FROM TBL_NAME FOR XML AUTO, ELEMENTS XSINIL) " but the out put structure was changed. For bulk copy to SQL its not supporting due the columnnames were not matching. Please suggest me how to create a XML including NULLs. Thanks in advance.
-
Hi all, I am trying to create a XML using DataSet.WriteXml. The XML was created, but its not creating any node for NULLs. I also tried by query "SELECT (SELECT * FROM TBL_NAME FOR XML AUTO, ELEMENTS XSINIL) " but the out put structure was changed. For bulk copy to SQL its not supporting due the columnnames were not matching. Please suggest me how to create a XML including NULLs. Thanks in advance.
Dunno, I've never used DataSet.WriteXml; for that matter, I rarely use a DataSet. I suggest using an XmlDocument or XmlTextWriter to create XML files. What I generally do for nulls is have an IsNull attribute that I can set:
<SomeValue IsNull="false" >blah</SomeValue>
<SomeValue IsNull="false" />
<SomeValue IsNull="true" />