Note that there are some explanatory texts on larger screens.

plurals
  1. POGot an error "Not supportedException was unhandled by user code"
    text
    copied!<p>I have table </p> <pre><code> product(table name) product_id product_name product_image product_price product_description category_id category(table name ) category_id category_name category_description </code></pre> <p>I have a combobox named it as <code>categoryCombobox</code> and grid view named it as <code>productgridview</code></p> <p>am trying to populate the datagrid depending upon the selection in the combobox.. like this ....</p> <pre><code> private viod form_load(object sender, EventArgs e) { var products = from prods in abc.products select new { prods.product_Id, productname = prods.product_Name, productimage = prods.product_Image, productprice = prods.product_Price, productdescription = prods.product_Description }; productbindingsource.DataSource = products; productgridview.DataSource = productbindingsource; productgridview.Columns[0].Visible = false; } private void categoryCombobox_SelectedIndexChanged(object sender, EventArgs e) { // is this query correct var categoryid = from productcategories in abc.categories where productcategories.category_Name.Equals(categoryCombobox.Text) select productcategories.category_Id; var produc = from pros in abc.products where pros.Category_Id.Equals(categoryid) select new { productname = pros.product_Name, productimage = pros.product_Image, productprice = pros.product_Price, productdescription = pros.product_Description }; productbindingsource.DataSource = produc; productgridview.DataSource = productbindingsource; productgridview.Columns[0].Visible = false; } </code></pre> <p>Got an error like this ......</p> <p>ERROR : At this line productbindingsource.DataSource = produc;</p> <blockquote> <p>Not supportedException was unhaldled by user code<br> Cannot compare elements of type 'System.Linq.IQueryable`1'. Only primitive types (such as Int32, String, and Guid) and entity types are supported.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload