莫名其妙的 看似很简单的问题 大哥大姐谁给看一下
DataTable DT1 = new DataTable();
DT1 = OracleHelper.Query("select * from t_wf_lb ").Tables[0];
DataTable DT2 = new DataTable();
DT2 = DT1;
Response.Write("dt1:" + DT1.Rows.Count + "<Br/>");
Response.Write("dt2:" + DT2.Rows.Count + "<Br/>");
DT2.Rows.RemoveAt(0);
Response.Write("dt1:" + DT1.Rows.Count + "<Br/>");
Response.Write("dt2:" + DT2.Rows.Count + "<Br/>");
输出结果:
dt1:11
dt2:11
dt1:10 (为什么不是11?)
dt2:10
------解决方案-------------------- DT2 = DT1;这只是引用,不是复制,对dt2的操作同样会影响dt1
------解决方案--------------------