当我加载页面时,我得到了一个具有相同密钥错误的项目。是否有解决方案来解决此问题?这里的错误
基本信息例外信息:消息:已添加具有相同密钥的项目
- - - - - - - - - - - - - - - - - - - - - - -
MachineName: WIN-SKEC08HPAEB FullName: InnoArk.APDMS.Common,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null AppDomainName:
/LM/W3SVC/2/ROOT-1-130120289473554687 ThreadIdentity: innoark
1) Exception Information
- - - - - - - - - - - - - - - - - - - - - - - Exception Type: System.ArgumentException Message: An item with the same key has
already been added. ParamName: NULL Data:
System.Collections.ListDictionaryInternal TargetSite: Void
ThrowArgumentException(System.ExceptionResource) HelpLink: NULL
Source: mscorlib
StackTrace Information
- - - - - - - - - - - - - - - - - - - - - - - at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue
value, Boolean add) at
System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at InnoArk.APDMS.WebApp.Controllers.SimulationController._List(Guid
GroupId, Guid bcTempId, String[] id, String[] volumeAnn, String[]
volumeAvg, String[] costAvg, String[] costAnn, String[] costIfAvg,
String[] costIfAnn, Boolean isEditBC, Boolean isBC, Boolean
isSimulate, Boolean isSave) in
D:\dev\APDMS\Trunk\InnoArk.APDMS.WebApp\Controllers\SimulationController.cs:line
2478
对不起,这里是从SimulationController的代码行2478:
detailList = new Dictionary<string, object>();
detailList.Add("id", entityId[j]);
detailList.Add("volAnn", volAnn[j]);
detailList.Add("volAvg", volAvg[j]);
detailList.Add("volLatestAnn", volLatestAnn[j]);
detailList.Add("volLatestAvg", volLatestAvg[j]);
detailList.Add("cAnn", cAnn[j]);
detailList.Add("cAvg", cAvg[j]);
detailList.Add("cIfAnn", cIfAnn[j]);
detailList.Add("cIfAvg", cIfAvg[j]);
detailList.Add("code", code[j]);
detailList.Add("isLatest", isLatest[j]);
detailList.Add("isDirty", isDirty[j]);
detailList.Add("curr", curr[j] == null ? "" : curr[j]);
detailList.Add("noOfOrder", noOfOrder[j]);
detailList.Add("isFilter", isFilter[j]);
tempList2.Add(entityId[j].ToString(), detailList); << line : 2478
感谢试图回答我的问题? :)
“SimulationC”的第2478行ontroller.cs'看起来像?也许发布它和周围的线? – 2013-05-03 06:36:42
你有没有调试过,你在'entityId [j] .ToString()' – Satpal 2013-05-06 07:52:01
你得到了如何使用tempList2?这听起来像是存储在Tempdata中。 – 2013-05-06 08:34:49