我有一个问题是在我的datagrid表中显示多行。如果您有任何问题的解决方案,请帮助。
这是我的代码:
private void button1_Click(object sender, EventArgs e)
{
try
{
XmlReader xmlFile;
xmlFile = XmlReader.Create("ORD_BS_734_1499_20180515_1318.xml", new XmlReaderSettings());
DataSet ds = new DataSet();
ds.ReadXml(xmlFile);
for (var i = 1; i < ds.Tables.Count; i++)
{
ds.Merge(ds.Tables[i]);
}
dataGridView1.AutoGenerateColumns = true;
//dataGridView1.DataSource = ds;
dataGridView1.DataSource = ds.Tables[0];
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
这是我的XML:
<Item>
<GTIN>35715475984623</GTIN>
<CustomerArticleIdLC>75681</CustomerArticleIdLC>
<CustomerArticleIdSAP>70000505</CustomerArticleIdSAP>
<ArticleName>VODA VODA</ArticleName>
<Quantity>96</Quantity>
<UOM>KOM</UOM>
</Item>