/ Published in: C#
Everything is either true or untrue, or both true and untrue, or neither true nor untrue
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static DataTable ConvertXmlNodeListToDataTable(XmlNodeList xnl) { int TempColumn = 0; foreach (XmlNode node in xnl.Item(0).ChildNodes) { TempColumn++; if (dt.Columns.Contains(node.Name)) { dt.Columns.Add(dc.ColumnName = dc.ColumnName + TempColumn.ToString()); } else { dt.Columns.Add(dc); } } int ColumnsCount = dt.Columns.Count; for (int i = 0; i < xnl.Count; i++) { DataRow dr = dt.NewRow(); for (int j = 0; j < ColumnsCount; j++) { dr[j] = xnl.Item(i).ChildNodes[j].InnerText; } dt.Rows.Add(dr); } return dt; }
URL: ideabubbling.com