我正在尝试使用以下LINQ语句来查询数据库,但我一直收到错误
重载解析失败,因为无法访问哪里可以调用 有了这些论点。
任何人都可以告诉我,我做错了,因为我一整天都把头发拉过来。
Return context.Logins _
.Include("Account.Children") _
.Include("aspnet_Membership") _
.Include("AccountType") _
.AsQueryable() _
.Where(Function(l) Not l.aspnet_Membership.Deleted AndAlso(l.FirstName.Contains(searchTerm) OrElse l.LastName.Contains(searchTerm) OrElse l.aspnet_Membership.Email.Contains(searchTerm) OrElse (1.FirstName & " " & 1.LastName).Contains(searchTerm) OrElse l.Account.Children.Any(Function(c) (c.FirstName & " " & c.LastName).Contains(searchTerm)))) _
.OrderBy(sortField) _
.ToList()
答案 0 :(得分:1)
建议修复(' 1'更改为' l')
Return context.Logins _
.Include("Account.Children") _
.Include("aspnet_Membership") _
.Include("AccountType") _
.AsQueryable() _
.Where(Function(l) Not l.aspnet_Membership.Deleted AndAlso(l.FirstName.Contains(searchTerm) OrElse l.LastName.Contains(searchTerm) OrElse l.aspnet_Membership.Email.Contains(searchTerm) OrElse (l.FirstName & " " & l.LastName).Contains(searchTerm) OrElse l.Account.Children.Any(Function(c) (c.FirstName & " " & c.LastName).Contains(searchTerm)))) _
.OrderBy(sortField) _
.ToList()