{"id":6524,"date":"2014-04-20T08:16:35","date_gmt":"2014-04-20T08:16:35","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/dblimitexpression-requires-a-collection-argument-collection-of-common-programming-errors-2\/"},"modified":"2014-04-20T08:16:35","modified_gmt":"2014-04-20T08:16:35","slug":"dblimitexpression-requires-a-collection-argument-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/dblimitexpression-requires-a-collection-argument-collection-of-common-programming-errors-2\/","title":{"rendered":"DbLimitExpression requires a collection argument-Collection of common programming errors"},"content":{"rendered":"<p>Does anyone have the faintest idea what this error means please and how to resolve it? All my research is drawing a blank, I can see how to set it on MSDN but it doesn&#8217;t explain it in a way that explains to me what the issue is. If I remove some of my LINQ queries to set viewbag items then it seems to resolve it but the moment I set new ones and pass them into my view to generate a mail for MVCMailer it comes back. Not sure if its a viewbag issue or simply that I am calling too many linq queries to generate them to pass to the view.<\/p>\n<p>I am very stuck (again)&#8230;&#8230;&#8230;.<\/p>\n<p>Cheers, Steve.<\/p>\n<p>DbLimitExpression requires a collection argument. Parameter name: argument Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.<\/p>\n<p>Exception Details: System.ArgumentException: DbLimitExpression requires a collection argument. Parameter name: argument<\/p>\n<p>An example of the code is:<\/p>\n<pre><code>            var VBSalutation = from A in context.Salutations\n                where A.SalutationId == policytransaction.SalutationId\n                select A.SalutationName;\n        ViewBag.Salutation = VBSalutation.FirstOrDefault();\n<\/code><\/pre>\n<p>This is repeated for various parameters and then passed to the view.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Does anyone have the faintest idea what this error means please and how to resolve it? All my research is drawing a blank, I can see how to set it on MSDN but it doesn&#8217;t explain it in a way that explains to me what the issue is. If I remove some of my LINQ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6524","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6524"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6524\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}