Reputation: 4430
In InsertData class, I want to get values from Combobox cbxCategory
but I can't get because dshang.tblCategory
is a table.
The error like:
Cannot implicitly convert type 'string' to 'EntityObject.tblCategory'(this is a table)
Category dshang = new Category();
string category = cbxCategory.SelectedValue.ToString();
dshang.tblCategory = category;
In the Entity data model, I define it's a table. So, I can't get this values from this.
public partial class ListProduct
{
public virtual tblCategory tblCategory { get; set; }
}
And here contain class define table tblPhanLoai
:
public partial class tblCategory
{
public tblCategory()
{
this.ListProducts = new HashSet<ListProduct>();
}
public string ID { get; set; }
public string Description { get; set; }
public string DonViTinh { get; set; }
public virtual ICollection<ListProduct> ListProducts { get; set; }
}
Upvotes: 0
Views: 213