This is a migrated thread and some comments may be shown as answers.

Query with conversion not implimented?

1 Answer 86 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 06 Oct 2010, 11:48 PM
var gsDirs = (from c in this.Context.GetItemCategories
                    where c.ItemID == itemid &&
                          c.ItemType == "Dictionary"
                    select c.ItemID).ToList();

ItemID is a string, I need gsDirs to be a List<int>

If I try and cast to int I get the

Execution of 'System.Convert:ToInt32(String)' on the database server side currently not implemented.

and a simple cast to (int) wont compile

1 Answer, 1 is accepted

Sort by
0
Petko_I
Telerik team
answered on 12 Oct 2010, 12:33 PM
Hi Steve,

The error you are receiving is exactly what you should be getting as the conversion really isn’t implemented on the server side now. However, we are currently changing our type converter system and will be able to facilitate server-side conversion in the future. For now, the in-memory conversion is a workaround to get the correct result set.

var gsDirs = (from c in this.Context.GetItemCategories
                    where c.ItemID == itemid &&
                          c.ItemType == "Dictionary"
                    select c.ItemID).ToList();
gsDirs = gsDirs.Select(x => Convert.ToInt32(x));

Do not hesitate to contact us if you have further questions.

Greetings,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
LINQ (LINQ specific questions)
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Petko_I
Telerik team
Share this question
or