字典我有下面的代码片断:从SQL表获取的行匹配使用LINQ
var matchingAuthors = from authors in DB.AuthorTable
where m_authors.Keys.Contains(authors.AuthorId)
select authors;
foreach (AuthorTableEntry author in matchingAuthors)
{
....
}
其中m_authors
是包含“作者”条目的字典,并且DB.AuthorTable
是一个SQL表。当m_authors的大小超过一定值(约3000项标志的地方),我得到一个异常:
System.Data.SqlClient.SqlException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Too many parameters were provided in this RPC request. The maximum is 2100.
有没有什么办法可以解决这个问题,并具有较大规模的字典工作?或者,有没有更好的方式来获得一个SQL表,其中该行的特定列值相匹配的字典条目之一的所有行?