How to use parameters in Entity Framework in a “in” clause?
问题 I am using Entity Framework 4.0 and I want to use the following query: To do that I do the following: strSQLQuery = "select * from MyTable where IDData IN (@IDs)"; lstParameters.Clear(); myParameter = new SqlParameter("@IDs", strIDs); lstParameters.Add(myParameter); myContext.MyTable.SqlQuery(strSQLQuery, lstParameters.ToArray<object>()).ToList<MyTable>(); But I get an exception that say that it is not possible to convert nvarchar to bigint . That is because the parameter is the type string,