But I keep getting the Error "System.Convert:ToDateTime(object) not supported on server side.
Is there another way I can get this done. HELP!!!
8 Answers, 1 is accepted
You have found the right solution. Calling outer methods in Linq queries is not yet supported.
the Telerik team
As a workaround in this case you could use the SQL<T> extension method that OpenAccess provides.
Here is an example how to achieve that for MSSQL using the convert function:
This should work for other backends as well, just the SQL in the string literal would be different.
Hope that helps.
All the best,
the Telerik team
I also have a problem I want my app to give me the expiry date in two months advance from the current date but I want that notification to stay there until the last date which will be an Expiry date .my query does work but the notification doesn't last till the last day of Expiry date please help
here is my query
var query = (from b in con.tblNewMachines
where b.Machine_Exp_Date >= DateTime.Now.AddMonths(2) &&
b.Machine_Exp_Date < DateTime.Now.AddMonths(3)
GridExpMachines.DataSource = query;
I am afraid I haven't completely understood your problem. Does your query run without any error but doesn't return the desired result? Can you ensure that the datetime values in the database are in the same timezone as specified in the condition (and not stored as UTC)?
Can you provide some more details about the problem.
ok lets me put it simple this time I want to show machines to be expire in two months but I want those machines to stay in my RadGrid untill the last day or until they Expire complete then Automatically they will be moved to another grid of machines that are Expired . hope you will understand me now but don't worry about those that are already expired that one is already sorted
From what I understand you should be querying for all objects with an expiry date within the next 2 months.
I would write the query as follows -
This would give you all the objects that expire within the next 2 months and would continue to return the object till you reach the expiry date.
Hope this is what you want.
Do get back in case you need further assistance.