私はXMlファイルを持っています私はこのコードを使用してすべてのXmlを読んでいます。しかし、XMLレコードをSQLテーブルに挿入したいのですが、読んだものは何でもです。そのための解決策は見つかりませんでした。XMlは行数で構成されており、適切な方法で挿入するにはどうすればよいですか。
if (File.Exists(xmlpath))
{
try
{
XDocument xmlDoc = XDocument.Load(xmlpath);
var vrresult = from a in xmlDoc.XPathSelectElements("/Parts/Part")
select new
{
S = a.Element("Section").Value,
M = a.Element("Mark").Value,
Q = a.Element("Qty").Value,
W = a.Element("Weight").Value,
RD = a.Element("databaseUpdateMark").Value
};
GridView1.DataSource = vrresult;
GridView1.DataBind();
}
catch (Exception ex)
{
Lbmsg.Text = ex.Message;
}
finally
{
}
}