|
发表于 2020-5-7 16:30:01
|
显示全部楼层
string OrderNumERP=null;
DB d = new DB();
XmlDocument xd = new XmlDocument();
xd.Load(File1.Value);
XmlNodeList xnl = xd.GetElementsByTagName("SCSSalesOrderHeader");
for (int i = 0; i < xnl.Count; i++)
{
sql = "insert into Header values(";
foreach (XmlNode xn in xnl[i].ChildNodes)
{
sql = sql + "'" + xn.InnerText + "',";
}
OrderNumERP = xnl[i].ChildNodes[3].InnerText;
sql = sql.Substring(0, sql.Length - 1);
sql = sql + ")";
d.gengxin(sql);
}
public void gengxin(string sql)
{
string name = ConfigurationManager.AppSettings["name"];
SqlConnection scon = new SqlConnection(con);
scon.Open();
SqlCommand scom = new SqlCommand(sql, scon);
scom.ExecuteNonQuery();
scon.Close();
}
写的比较乱 |
|