Open
Description
Type of issue
Code doesn't work
Description
Dim dataEntities As AdventureWorksLT2022Entities = New AdventureWorksLT2022Entities
Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
**_Dim products As ObjectQuery(Of Product) = dataEntities.Products_**
Dim query =
From product In products
Where product.Color = "Red"
Order By product.ListPrice
Select product.Name, product.Color, CategoryName = product.ProductCategory.Name, product.ListPrice
DataGrid1.ItemsSource = query.ToList()
End Sub
Page URL
Content source URL
Document Version Independent Id
e76201c9-a0c3-5d1f-af69-45c453b4c08f
Platform Id
6125d80b-66e1-7160-f8ec-264b4ce48ff0
Article author
Metadata
Dim dataEntities As AdventureWorksLT2022Entities = New AdventureWorksLT2022Entities
Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
**_Dim products As ObjectQuery(Of Product) = dataEntities.Products_**
Dim query =
From product In products
Where product.Color = "Red"
Order By product.ListPrice
Select product.Name, product.Color, CategoryName = product.ProductCategory.Name, product.ListPrice
DataGrid1.ItemsSource = query.ToList()
End Sub
I get an error message in visual studio that "Value of Type Dbset(Of Product) can't be converted to value Object Query(Of Product)