S
Steve Richter
getting this error:
Method 'System.Object DynamicInvoke(System.Object[])' has no supported
translation to SQL.
when IQueryable is called and the Where method of Linq.Table is passed
a multi line Func expression:
private pcarDataContext db = new pcarDataContext();
public IQueryable<AccountMasterRow> FindAccountMasterRows(
string InLikeName)
{
string s1 = InLikeName.ToLower();
Func<AccountMasterRow,bool> func = r =>
{
int rv = r.FullName.ToLower().IndexOf(s1);
if (rv >= 0)
return true;
else
return false;
};
return db.AccountMasterRows.Where(
r => func(r)
);
I also get a similar error when passing in a lambda to the Where
method:
The member 'pcar.Models.AccountMasterRow.FullName' has no supported
translation to SQL.
return db.AccountMasterRows.Where(r => r.FullName.ToLower
().IndexOf(s1) >= 0);
In this case, FullName is a public property in the AccountMasterRow
class.
asking for an explanation of this error message.
thanks,
-Steve
Method 'System.Object DynamicInvoke(System.Object[])' has no supported
translation to SQL.
when IQueryable is called and the Where method of Linq.Table is passed
a multi line Func expression:
private pcarDataContext db = new pcarDataContext();
public IQueryable<AccountMasterRow> FindAccountMasterRows(
string InLikeName)
{
string s1 = InLikeName.ToLower();
Func<AccountMasterRow,bool> func = r =>
{
int rv = r.FullName.ToLower().IndexOf(s1);
if (rv >= 0)
return true;
else
return false;
};
return db.AccountMasterRows.Where(
r => func(r)
);
I also get a similar error when passing in a lambda to the Where
method:
The member 'pcar.Models.AccountMasterRow.FullName' has no supported
translation to SQL.
return db.AccountMasterRows.Where(r => r.FullName.ToLower
().IndexOf(s1) >= 0);
In this case, FullName is a public property in the AccountMasterRow
class.
asking for an explanation of this error message.
thanks,
-Steve