title: how to get single value by using entity framework
body: <p>I have a </p>
  
  <pre><code>     table product with colums product_id 
                                 prodcut_name
                                 category_id
  
                  another table  category 
                                 category_id
                                 category_name
  </code></pre>
  
  <p>and i  am populating these product details using datagridview that working fine </p>
  
  <p>and i need to get the categoryname for selected row in datagridview for that i have done like this....</p>
  
  <pre><code>        private void productGridview_Cellclick(object sender, DataGridViewCellEventArgs e)
          {
                 string productname = Convert.ToString(selectedRow.Cells["productnam"].Value);
                 var categoryids = from cats in abc.products
                                  where cats.product_Name.Equals(productname)
                                  select cats.category_Id;
  
  
              var catogynames = from categorytypes in abc.categories
                                where categorytypes.category_Name.Equals(categoryids)
                                select categorytypes.category_Name;
  
  
              string categorynames = catogynames;    
  
         }                              
  </code></pre>
  
  <p>got an</p>
  
  <pre><code>  error : cannot implicitly convert type sysytem.linq.iqueryble&lt;string&gt; to string ...
  </code></pre>
  
  <p>what i need to do to get the single category name for selected cell in productgridview productnam column </p>
  
  <p>any suggestions.. pls ..</p>
  
  <p>many thanks.... </p>
  
  <p><strong>Modified Code:</strong>
                 got an error :</p>
  
  <pre><code>not supported exception:
  
  Unable to create a constant value of type 'System.Object'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.
  </code></pre>