This question is locked. New answers and comments are not allowed.
I am getting the following runtime error when executing a linq query that uses a list as the equivalent to the sql in clause
Object of type
'Telerik.OpenAccess.Query.Piece`1[<>f__AnonymousType17`6[System.Int32,System.String,System.String,System.String,System.String,System.String]]' cannot be converted to type 'Telerik.OpenAccess.Query.Piece`1[System.Int32]'.
Here is my code:
Here is the sql code generated by linq query.
Any ideas why the generated sql query contains question marks instead of the integers from the equipList list?
Thanks for your help.
Object of type
'Telerik.OpenAccess.Query.Piece`1[<>f__AnonymousType17`6[System.Int32,System.String,System.String,System.String,System.String,System.String]]' cannot be converted to type 'Telerik.OpenAccess.Query.Piece`1[System.Int32]'.
Here is my code:
IList<
int
> equipList =
new
List<
int
>();
foreach
(RadListBoxItem item
in
SelectedEquipment_LB.Items)
{
equipList.Add(Convert.ToInt32(item.Value));
}
var query = from eq
in
dbContext.InventoryVwEquipments
where equipList.Contains(eq.EquipId)
select
new
{ eq.EquipId, eq.EquipmentName, eq.Company, eq.Series, eq.Model, eq.Serial };
RadListView1.DataSource = query;
Here is the sql code generated by linq query.
SELECT a.[EquipId] AS COL1, a.[EquipmentName] AS COL2, a.[Company] AS COL3, a.[Series] AS COL4, a.[Model] AS COL5, a.[Serial] AS COL6 FROM [Inventory].[vwEquipment] a WHERE (a.[EquipId] IN (?,?,?,?,?,?,?,?,?,?,?,?))
Any ideas why the generated sql query contains question marks instead of the integers from the equipList list?
Thanks for your help.