0

Getting error when I pass more then 2400 items.

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.

How to solve this? My code is as below:

using (var dc = new DataContext(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]))
{
    products = dc.Products.Where(x => productIds.Contains(x.product_id)).ToList();
}
codeMonkey
  • 4,134
  • 2
  • 31
  • 50
  • You Can go do manual sql and use table value parameters. This Will remove the 2100 entry limitation which (is a weird thing in sql by the way) :) – Stephan Møller Feb 14 '20 at 19:02
  • 1
    You can also pass a XML or JSON string as a parameter and shred it in your query. It may also require writing manual query. – Piotr Palka Feb 14 '20 at 19:07
  • You can write a manual query and use a table valued parameter or XML or JSON. If you want it to be performant that is the way I would go. Or you can use the link from the marked duplicate. – Igor Feb 14 '20 at 19:17

0 Answers0