private static void ModifyInBatch(List<int> ids)
{
//Hashtable ht = new Hashtable();
List<int> subIdList = new List<int>();
if (ids != null && ids.Count > 0)
{
int range = 200;//每批的数量
int times = ids.Count / range + (ids.Count % range > 0 ? 1 : 0);//交互次数
for (int i = 0; i < times; i++)
{
var tmpIds = ids.GetRange(i * range, (i + 1) * range > ids.Count ? (ids.Count - i * range) : range);
//ht.Add("HR_ID", tmpIds);
subIdList.AddRange(tmpIds);
UpdateDataBase(subIdList);
//ht.Remove("HR_ID");
subIdList.Clear();
}
}
Console.ReadKey();
}
private static void UpdateDataBase(Hashtable ht)
{
foreach (string key in ht.Keys)
{
List<int> aa = ht[key] as List<int>;
Console.WriteLine("Key为{0}; Count为{1}:{2}~{3}", key, aa.Count, aa.FirstOrDefault(), aa.LastOrDefault());
}
}
private static void UpdateDataBase(List<int> aa)
{
Console.WriteLine(" Count为{0}:{1}~{2}", aa.Count, aa.FirstOrDefault(), aa.LastOrDefault());
}