【发布时间】:2009-08-24 22:31:28
【问题描述】:
我有以下代码sn-p:
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 表中的所有行,其中该行的特定列值与字典条目之一匹配?
【问题讨论】:
标签: c# linq linq-to-sql dictionary