0
如何添加DataGridView中的数据,数据集(包括列名)添加DataGridView中的数据为DataSet
嗯,我开始并在下面的代码的中间stucked起来:
DataTable table = new DataTable();
DataRow newRow = new DataRow();
table.Columns.Add("productname"); //first column
table.Columns.Add("brandname"); //second column
table.Columns.Add("quantity"); //third column
table.Columns.Add("price"); //fourth column
然后,我需要该数据集写入到一个XML文件,这样
<stock>
<items> //How to add these two extra tags? ('stock' and 'items')
----Column Names----
<items>
<stock>
请提前帮助
感谢。
感谢您的答复。然后如何将它添加到带有两个额外标签的xml文件中,我提到了这个问题。我知道如何写,但我不知道如何添加额外的标签。 –
@Mr_Green chk更新后的部分 – Talha
实际上,我不需要为创建的表格添加两个父元素,即“stock”和“items”。正如我在问题中提到的那样 –