给定关键字不在字典中。

hong320 2010-01-18 04:37:02
在访问sql 2005时语句 string sql = "select userId, sum(amount) from [Order] group by userId order by sum(amount) desc";
出现一个“System.Collections.Generic.KeyNotFoundException: 给定关键字不在字典中。“这样的异常,
可能可能大概是表名关键字的[Order]转义问题,那位高手能帮我看一看是怎么回事,


错误详细信息:
堆栈跟踪:


[KeyNotFoundException: 给定关键字不在字典中。]
System.ThrowHelper.ThrowKeyNotFoundException() +28
System.Collections.Generic.Dictionary`2.get_Item(TKey key) +2639328
Autumn.Data.AbstractImpl`1.FillEntiry(DataRow row) +264
Autumn.Data.AbstractImpl`1.SelectByTSQL(String sqlCommand) +337
Autumn.Factory.DALFactory`1.SelectByTSQL(String sqlCommand) +130
BoyaGarden.BLL.OrderService.GetOrderConsumption() in C:\Documents and Settings\Administrator\桌面\BoyaGarden\BoyaGarden.BLL\OrderService.cs:24

[TargetInvocationException: 调用的目标发生了异常。]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +296
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +484
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1815
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +13
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68
System.Web.UI.WebControls.GridView.DataBind() +5
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +61
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +67
System.Web.UI.Control.EnsureChildControls() +97
System.Web.UI.Control.PreRenderRecursiveInternal() +50
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5675


...全文
1442 3 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
myq19891024 2011-10-18
  • 打赏
  • 举报
回复
怎么解决的呀,我现在遇到这样的问题了,解决不了!请教!
hong320 2010-01-18
  • 打赏
  • 举报
回复
呵呵,谢谢,问题刚刚解决了 ,谢谢,谢谢
ljc007 2010-01-18
  • 打赏
  • 举报
回复
CSDN除了有站务版块之外,还有个SQL Server版块,楼主去看看吧。
相关推荐
发帖
客服专区

454

社区成员

客服专区
其他 技术论坛(原bbs)
社区管理员
  • 客服专区社区
加入社区
帖子事件
创建了帖子
2010-01-18 04:37
社区公告
暂无公告