I want to insert data using XML in SQL Server 2005. So I got one datatable from the BackEnd and I passed the DataTable as follows;
DataSet dsItem = new DataSet();
DTItem.TableName = "ItemDetails"; //DTItem is the DataTable I got from the BackEnd
dsItem.Tables.Add(DTItem);
My problem is, If any column contains null value then the XML not taking that null column. For ex: Consider this is my DataTable
JobOrderID CustomerID
------------ ------------
4
Here CustomerID is null. When I fix the Trace and View, the DataTable which shows empty instead of null. So. When I pass the DataTable, the XML does not consider the Null column. It takes as follows
<NewDataSet>
<ItemDetails>
<JobOrderID>4</JobOrderID>
</ItemDetails>
</NewDataSet>
It is not taking CustomerID, So the insertion is not working. Why the DataTable does not show the Null values in the Column fields and How to pass if the DataTable containing null value as a XML? Please any suggestions.