This question is locked. New answers and comments are not allowed.
I am getting the following error:
on the following code:
Any ideas? Commented out code returns similar errors...
| Server Error in '/' Application. |
| -------------------------------------------------------------------------------- |
| System.Linq.Enumerable.Count over Convert(g) |
| 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. |
| Exception Details: System.NotSupportedException: System.Linq.Enumerable.Count over Convert(g) |
| Source Error: |
| Line 30: Dim categories = northwind.Extent(Of Product)().GroupBy(Function(p) p.Category.CategoryName).Select(Function(g) New With {g.Key, g.Count(), .Sum = g.Sum(Function(p) p.UnitsInStock), .Average = g.Average(Function(p) p.UnitPrice)}) |
| Line 31: rcbCategories.DataSource = categories |
| Line 32: rcbCategories.DataBind() |
| Line 33: PopulateProductGrid(rcbCategories.SelectedValue) |
| Line 34: PopulateSalesGrid(rcbCategories.SelectedValue, rcbYear.SelectedValue) |
| Source File: C:\Users\terry.webster\Documents\Visual Studio 2008\Projects\OpenAccessORM101\WebClient\Default.aspx.vb Line: 32 |
| Stack Trace: |
| [NotSupportedException: System.Linq.Enumerable.Count over Convert(g)] |
| Telerik.OpenAccess.Query.QueryContext.PerformDatabaseQuery(Type type, Expression expression, Int32& number, Boolean exec, Int32 numSkip, Int32 numTake) +813 |
| Telerik.OpenAccess.Query.QueryContext.PerformDatabaseQueryMultiple(Expression expression) +291 |
| Telerik.OpenAccess.Query.ObjectScopeQuery`2.System.Collections.IEnumerable.GetEnumerator() +144 |
| Telerik.Web.UI.ControlDataBinder.BindToEnumerableData(IEnumerable dataSource) +73 |
| Telerik.Web.UI.ControlItemContainer.PerformDataBinding(IEnumerable data) +342 |
| Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +47 |
| Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +39 |
| System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31 |
| Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +114 |
| Telerik.Web.UI.RadComboBox.PerformSelect() +37 |
| System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73 |
| WebClient._Default.Page_Load(Object sender, EventArgs e) in C:\Users\terry.webster\Documents\Visual Studio 2008\Projects\OpenAccessORM101\WebClient\Default.aspx.vb:32 |
| System.Web.UI.Control.OnLoad(EventArgs e) +99 |
| System.Web.UI.Control.LoadRecursive() +50 |
| System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 |
| -------------------------------------------------------------------------------- |
| Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074 |
on the following code:
| If Not IsPostBack Then |
| Dim northwind = NorthWindScopeProvider.ObjectScope() |
| 'Dim categories = From p In northwind.Extent(Of Product)() _ |
| ' Group p By Key = p.Category.CategoryName Into CategoryGroup = Group _ |
| ' Select New With _ |
| ' { _ |
| ' .Category = Key, _ |
| ' .Products = CategoryGroup.Count(), _ |
| ' .TotalUnits = CategoryGroup.Sum(Function(p) p.UnitsInStock), _ |
| ' .AveragePrice = CategoryGroup.Average(Function(p) p.UnitPrice) _ |
| ' } |
| Dim categories = northwind.Extent(Of Product)().GroupBy(Function(p) p.Category.CategoryName).Select(Function(g) New With {g.Key, g.Count(), .Sum = g.Sum(Function(p) p.UnitsInStock), .Average = g.Average(Function(p) p.UnitPrice)}) |
| rcbCategories.DataSource = categories |
| rcbCategories.DataBind() |
| PopulateProductGrid(rcbCategories.SelectedValue) |
| PopulateSalesGrid(rcbCategories.SelectedValue, rcbYear.SelectedValue) |
| End If |
Any ideas? Commented out code returns similar errors...