Below is the code I'm using but it replies with
Method 'Boolean isUser(System.String)' has no supported translation to SQL.
Any help? Btw I'm using linq to SQL data source
public void dataBind()
{
using (var gp = new GreatPlainsDataContext())
{
var emp = from x in gp.Employees
let k = isUser(x.ID)
where x.ActivtyStatus == 0
&& isUser(x.ID) != false
orderby x.ID
select new
{
ID = x.ID,
Name = x.FirstName + " " + x.MiddleName
};
ListView1.DataSource = emp;
ListView1.DataBind();
}
}
public static bool isUser(string ID)
{
int temp;
bool x = int.TryParse(ID, out temp);
return x;
}
I found a solution to query the result of the first query as objects but is that good cause I will passing through my data twice.
the updated code that worked in the end after using the like as advised by Anders Abel
public void dataBind()
{
using (var gp = new GreatPlainsDataContext())
{
var emp = from x in gp.Employees
where x.ActivtyStatus == 0
&& SqlMethods.Like(x.ID, "[0-9]%")
orderby x.ID
select new
{
ID = x.ID,
Name = x.FirstName + " " + x.MiddleName
};
ListView1.DataSource = emp;
ListView1.DataBind();
}
}