需要把修改的键clear()掉,然后重新加入键和值!如果你直接修改values的值,会提示加入重复的键!!
如:
清除部分键----
ht.Remove("f_punish_id");
ht.Remove("f_dispose_dep");
ht.Remove("f_dep_type");
ht.Remove("f_punish_time");
ht.Remove("f_recall_flag");
ht.Remove("f_batch");
int PunishInfo = db._GetSerialNum("cfxi");//取得处罚信息编号
ht.Add("f_punish_id",PunishInfo);//处罚信息编号
ht.Add("f_dispose_dep",Credit.Common.SessionInfo.DistCode);//处理部门
ht.Add("f_dep_type",Credit.Common.SessionInfo.GovType);//处理部门类型
ht.Add("f_punish_time",System.DateTime.Now.ToString());//处罚时间
ht.Add("f_recall_flag",0);//撤消处罚标志0:未撤消1:已经撤消
if (batch != "")
{
ht.Add("f_batch",Convert.ToInt32(batch));//
}
else
{
int S_batch = db._GetSerialNum("cfpc");//
ht.Add("f_batch",S_batch);//
}清除所有键----
Hashtable ht_v = new Hashtable();
for(int i=0;i<arrlist.Count;i++)
    {
ht_v.Clear();
ht_v.Add("f_dispose_id",PunishInfo);
ht_v.Add("f_dispose_type",2);
ht_v.Add("f_rule_code",arrlist[i].ToString().Trim());
ht_v.Add("f_violate_id",db._GetSerialNum("tp_ViolateInfo_ID"));
db._AddTableRow("tp_ViolateInfo",ht_v);
    }