我想将数据表转换为 xml 字符串并将其存储在数据库中,这是代码
DataSet s = new DataSet();
DataTable dt = s.Tables.Add();
dt.Columns.Add("ID", typeof(string));
dt.Columns.Add("Name",typeof(string));
dt.Rows.Add(new object[] { 1, "Mary" });
dt.Rows.Add(new object[] { 2, "Andy" });
dt.Rows.Add(new object[] { 3, "Peter" });
dt.Rows.Add(new object[] { 4, "Russ" });
StringWriter sw = new StringWriter();
dt.WriteXml(sw);
Console.WriteLine(sw.ToString());
the output is like :
<NewDataSet>
<Table1>
<ID>1</ID>
<Name>Mary</Name>
</Table1>
<Table1>
<ID>2</ID>
<Name>Andy</Name>
</Table1>
<Table1>
<ID>3</ID>
<Name>Peter</Name>
</Table1>
<Table1>
<ID>4</ID>
<Name>Russ</Name>
</Table1>
</NewDataSet>
如何识别每一行?我可以更改每一行的节点吗?我是说标签