【发布时间】:2011-07-21 22:41:39
【问题描述】:
PaymentsDueEntityDataSource.ContextTypeName = "Bills.DAL.BillsEntities";
PaymentsDueEntityDataSource.EnableFlattening = false;
PaymentsDueEntityDataSource.EntitySetName = "tblPayments_Due";
PaymentsDueEntityDataSource.Where = "it.UserName = " + HttpContext.Current.User.Identity.Name.ToString();
PaymentsDueEntityDataSource.Include = "tblType, tblRepeat";
PaymentsDueEntityDataSource.EnableUpdate = true;
当我删除 Where 子句时,我的 gridview 会返回所有记录。当我硬编码从 HTML 中的 HttpContextxt 字符串生成的相同字符串时,我的 gridview 返回正确的记录。但是,当我尝试使用上面的代码时,我收到了超出范围的消息:
'kwingat' 无法在当前范围或上下文中解析。确保所有引用的变量都在范围内,加载了所需的模式,并且正确地引用了命名空间。靠近简单标识符,第 6 行,第 15 列。
有什么想法吗?
【问题讨论】:
标签: c# .net entity-framework