在2005中将xml文件insert到数据库字段,字段为xml类型。
------解决方案--------------------
//price
TextReader tr = new StringReader(hidxml.Value);
DataSet ds = new DataSet();
ds.ReadXml(tr,XmlReadMode.Auto);
for (int i=0;i <hidxml.Value.Split( ', ').Length;i++)
{
price = Convert.ToDouble(hidxml.Value.Split( ', ')[i].ToString());
totalPrice = Convert.ToDouble(hidxml.Value.Split( ', ')[i].ToString());
sql = "update Goods set unit_price = " + price + ",total_price = "+ totalPrice + " where id= ' "+ hidxml.Value.Split( ', ')[i].ToString() + " ' ";
Conn_Purchase.SqlHelper.ExecuteNonQuery(CommandType.Text,sql,null);
}
做个参考。
hidxml.Value 为protected System.Web.UI.HtmlControls.HtmlInputHidden hidxml;