【求助】我的session["orderline"]怎么不能把值传给DataTable呢?急求答案。。。
如题所示,这是全部代码:
if (Session["orderline"] != null)
{
DataTable DT = new DataTable();
DT = Session["orderline"] as DataTable;
for (int i = 0; i < DT.Rows.Count; i++)
{
DataRow rw = dataTable.NewRow();
rw["ItemCode"] = DT.Rows[i]["ItemCode"];
rw["Dscription"] = DT.Rows[i]["Dscription"];
rw["U_U001"] = DT.Rows[i]["U_U001"];
rw["PriceBefDi"] = DT.Rows[i]["PriceBefDi"];
rw["U_U012"] = DT.Rows[i]["U_U012"];
rw["ShipDate"] = DT.Rows[i]["ShipDate"];
rw["U_ZK"] = DT.Rows[i]["U_ZK"];
rw["quantity"] = DT.Rows[i]["quantity"];
rw["LineTotal"] = DT.Rows[i]["LineTotal"];
rw["Price"] = DT.Rows[i]["Price"];
rw["U_NDFL"] = DT.Rows[i]["U_NDFL"];
rw["U_JDFL"] = DT.Rows[i]["U_JDFL"];
rw["U_YDFL"] = DT.Rows[i]["U_YDFL"];
rw["U_ZXFL"] = DT.Rows[i]["U_ZXFL"];
rw["U_GGFL"] = DT.Rows[i]["U_GGFL"];
rw["U_ZLFL"] = DT.Rows[i]["U_ZLFL"];
dsOrderLine.Tables[0].Rows.Add(rw);
}
}
在session["orderline"]中明明是有数据的,但是DT却为空,这是怎么个情况呢?求帮助~~~~
[解决办法]
存的时候用DataSet.Tables[0] 再存进Session