public static void ClearDataCache() { modSpecialtopics.Clear(); if (CatKeymodSpecialtopics.Count > 0) { foreach (var item in CatKeymodSpecialtopics.Values) { item.Clear(); } } CatKeymodSpecialtopics.Clear(); CatKeymodSpecialtopics = null; if (Dtspecial != null) { CommonService.DisposeDataTable(Dtspecial); } Dtspecial = null; if (Dtspecialcategory != null) { CommonService.DisposeDataTable(Dtspecialcategory); } Dtspecialcategory = null; foreach (var value in dictionaryTreeData.Values) { CommonService.DisposeDataTable(value); } dictionaryTreeData.Clear(); dictionaryTreeData = null; }
/// <summary> /// 将一个数据表融合到另一个数据表中 /// </summary> /// <param name="Source">要融合的数据表</param> /// <param name="target">融合后的数据表</param> public static void MergeDataTable(DataTable Source, DataTable target) { //target.BeginLoadData(); foreach (DataRow dataRow in Source.Rows) { DataRow data = target.NewRow(); data.ItemArray = dataRow.ItemArray; target.Rows.Add(data); } target.AcceptChanges(); // target.EndLoadData(); CommonService.DisposeDataTable(Source); }