title: Cannot implicitly convert type System.Data.Entity.DbSet<DataGridSQLExample.Product> to System.Data.Objects.ObjectQuery<DataGridSQLExample.Product>
body: <p>I am using Visual Studio 2012 C Sharp (C#) and SQL Server Express.  I am trying to go through the MSDN Walkthrough: Display Data from a SQL Server Database in a DataGrid Control.  I have added the recommended AdventureWorksLT2008 sample database.  Here are the instructions I followed:</p>
  
  <ol>
  <li>Create a new WPF Application project in Visual Basic or C#, and name it DataGridSQLExample.</li>
  <li>In Solution Explorer, right-click your project, point to Add, and then select New Item. ( The Add New Item dialog box appears. )</li>
  <li>In the Installed Templates pane, select Data and in the list of templates, select ADO.NET Entity Data Model.</li>
  <li>Name the file <code>AdventureWorksModel.edmx</code> and then click Add. (The Entity Data Model Wizard appears.)</li>
  <li>In the Choose Model Contents screen, select Generate from database and then click Next.</li>
  <li>In the Choose Your Data Connection screen, provide the connection to your AdventureWorksLT2008 database.</li>
  <li>Make sure that the name is AdventureWorksLT2008Entities and that the Save entity connection settings in <code>App.Config</code> as check box is selected, and then click Next.</li>
  <li>In the Choose Your Database Objects screen, expand the Tables node, and select the Product and ProductCategory tables.</li>
  <li>Click Finish.</li>
  </ol>
  
  <p>To retrieve and present the data:</p>
  
  <ol>
  <li>Open the <code>MainWindow.xaml</code> file.</li>
  <li>Set the Width property on the Window to 450.</li>
  <li>In the XAML editor, add the following DataGrid tag between the <code>&lt;Grid&gt;</code> and <code>&lt;/Grid&gt;</code> tags to add a DataGrid named <code>dataGrid1</code>.</li>
  <li>Select the Window.</li>
  <li>Using the Properties window or XAML editor, create an event handler for the Window named <code>Window_Loaded</code> for the Loaded event.</li>
  <li>Open the code-behind file (<code>MainWindow.xaml.vb</code> or <code>MainWindow.xaml.cs</code>) for the Window.</li>
  <li><p>Add the following code to retrieve only specific values from the joined tables and set the <code>ItemsSource</code> property of the DataGrid to the results of the query:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data.Objects;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Data;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Imaging;
  using System.Windows.Navigation;
  using System.Windows.Shapes;
  
  
  namespace DataGridSQLExample
  {
      /// &lt;summary&gt; 
      /// Interaction logic for MainWindow.xaml 
      /// &lt;/summary&gt; 
      public partial class MainWindow : Window
      {
          AdventureWorksLT2008Entities dataEntities = new AdventureWorksLT2008Entities();
  
          public MainWindow()
          {
              InitializeComponent();
          }
  
          private void Window_Loaded(object sender, RoutedEventArgs e)
          {
              ObjectQuery&lt;Product&gt; products = dataEntities.Products;
  
              var query =
              from product in products
              where product.Color == "Red"
              orderby product.ListPrice
              select new { product.Name, product.Color, CategoryName = product.ProductCategory.Name, product.ListPrice };
  
              dataGrid1.ItemsSource = query.ToList();
          }
      }
  }
  </code></pre></li>
  <li>Run the example. You should see a DataGrid that displays data.</li>
  </ol>
  
  <p>When I run I get this error:</p>
  
  <blockquote>
    <p><strong>Cannot implicitly convert type 'System.Data.Entity.DbSet' to
    'System.Data.Objects.ObjectQuery'</strong> on
    this line: <strong>ObjectQuery products = dataEntities.Products;</strong></p>
  </blockquote>
  
  <p>Nothing I have tried works - any suggestions?</p>